Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754989Ab2F3OZg (ORCPT ); Sat, 30 Jun 2012 10:25:36 -0400 Received: from netrider.rowland.org ([192.131.102.5]:55495 "HELO netrider.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1754214Ab2F3OZe (ORCPT ); Sat, 30 Jun 2012 10:25:34 -0400 Date: Sat, 30 Jun 2012 10:25:32 -0400 (EDT) From: Alan Stern X-X-Sender: stern@netrider.rowland.org To: Len Brown cc: linux-acpi@vger.kernel.org, , Pavel Vasilyev , , Len Brown Subject: Re: [linux-pm] [PATCH 1/8] ACPI sysfs.c strlen fix In-Reply-To: <9f132652d94c96476b0b0a8caf0c10e96ab10fa8.1341032550.git.len.brown@intel.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1221 Lines: 37 On Sat, 30 Jun 2012, Len Brown wrote: > From: Pavel Vasilyev > > Current code is ignoring the last character of "enable" and "disable" > in comparisons. > > https://bugzilla.kernel.org/show_bug.cgi?id=33732 > > Signed-off-by: Len Brown > --- > drivers/acpi/sysfs.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/acpi/sysfs.c b/drivers/acpi/sysfs.c > index 9f66181..240a244 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") - 1)) { > + if (!strncmp(val, "enable", strlen("enable"))) { Ironically, this is the less efficient of two possible fixes. It would have been better to leave the "- 1" in place and change strlen to sizeof. That's probably what the original author had in mind. Alan Stern -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/