From patchwork Fri Jul 27 01:39:38 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Len Brown X-Patchwork-Id: 1246721 Return-Path: X-Original-To: patchwork-linux-acpi@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 84395DFFCE for ; Fri, 27 Jul 2012 01:40:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752556Ab2G0Bjo (ORCPT ); Thu, 26 Jul 2012 21:39:44 -0400 Received: from mail-vc0-f174.google.com ([209.85.220.174]:51603 "EHLO mail-vc0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752538Ab2G0Bjo (ORCPT ); Thu, 26 Jul 2012 21:39:44 -0400 Received: by vcbfk26 with SMTP id fk26so2316051vcb.19 for ; Thu, 26 Jul 2012 18:39:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=d29bOV/TTKAEX/0+hYkNhPkcyWeQp3/gYrtbVXK6p2w=; b=hfQzzPWJo4c657tmm4GwHfe0XVM58wGNMQ2D10IZJZlAEbRJK9wuX6iXLutwDF7xEx ap0kU3f0XkhIkFil3E+GlpZy3YQWUQxCthSjGVjmzcLtwwG53lUbBjJtG6jwfeES0ZRW zP5vhECIAiEdz4FzKHLJBH7Xa4AG0inEVaKtA39Vcpi1vAwBiraqxF6jrkFUzsDvN8LS OGKR58e1la+xzDtxz1RDHfh8huL7duNgRn0Zu5LKh8RAfsgvyE9u9iTqJpcNEEI/1XX6 HKY1NngeFG4+toKSnV6n8eVjWl4kKxScb/by0YHJQmPgB+DvX9pVeGuo/MScy/cPweJB Eqkg== Received: by 10.52.23.136 with SMTP id m8mr779441vdf.28.1343353183047; Thu, 26 Jul 2012 18:39:43 -0700 (PDT) Received: from [192.168.0.98] (h184-61-125-197.altnnh.dsl.dynamic.tds.net. [184.61.125.197]) by mx.google.com with ESMTPS id d11sm877124vdf.15.2012.07.26.18.39.40 (version=SSLv3 cipher=OTHER); Thu, 26 Jul 2012 18:39:41 -0700 (PDT) Message-ID: <5011F15A.3060007@kernel.org> Date: Thu, 26 Jul 2012 21:39:38 -0400 From: Len Brown User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120717 Thunderbird/14.0 MIME-Version: 1.0 To: Alan Stern CC: linux-acpi@vger.kernel.org, linux-pm@lists.linux-foundation.org, Pavel Vasilyev , linux-kernel@vger.kernel.org, Len Brown Subject: [PATCH] ACPI: replace strlen("string") with sizeof("string") -1 References: In-Reply-To: Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org ...both give the number of chars in the string without the '\0', as strncmp() wants, but sizeof() is compile-time. Reported-by: Alan Stern Cc: Pavel Vasilyev Signed-off-by: Len Brown --- drivers/acpi/sysfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) if (result) @@ -181,7 +181,7 @@ static int param_set_trace_state(const char *val, struct kernel_param *kp) goto exit; } - if (!strncmp(val, "disable", strlen("disable"))) { + if (!strncmp(val, "disable", sizeof("disable") - 1)) { int name = 0; result = acpi_debug_trace((char *)&name, trace_debug_level, trace_debug_layer, 0); diff --git a/drivers/acpi/sysfs.c b/drivers/acpi/sysfs.c index 240a244..7c3f98b 100644 --- a/drivers/acpi/sysfs.c +++ b/drivers/acpi/sysfs.c @@ -173,7 +173,7 @@ static int param_set_trace_state(const char *val, struct kernel_param *kp) { int result = 0; - if (!strncmp(val, "enable", strlen("enable"))) { + if (!strncmp(val, "enable", sizeof("enable") - 1)) { result = acpi_debug_trace(trace_method_name, trace_debug_level, trace_debug_layer, 0);