From: Len Brown <lenb@kernel.org> To: Alan Stern <stern@rowland.harvard.edu> Cc: linux-acpi@vger.kernel.org, linux-pm@lists.linux-foundation.org, linux-kernel@vger.kernel.org, Len Brown <len.brown@intel.com>, Pavel Vasilyev <pavel@pavlinux.ru> Subject: [PATCH] ACPI: replace strlen("string") with sizeof("string") -1 Date: Thu, 26 Jul 2012 21:39:38 -0400 [thread overview] Message-ID: <5011F15A.3060007@kernel.org> (raw) In-Reply-To: <Pine.LNX.4.44L0.1206301023540.29029-100000@netrider.rowland.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 <stern@rowland.harvard.edu> Cc: Pavel Vasilyev <pavel@pavlinux.ru> Signed-off-by: Len Brown <len.brown@intel.com> --- 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 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); 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); -- 1.7.12.rc0
WARNING: multiple messages have this Message-ID (diff)
From: Len Brown <lenb@kernel.org> To: Alan Stern <stern@rowland.harvard.edu> Cc: linux-acpi@vger.kernel.org, linux-pm@lists.linux-foundation.org, Pavel Vasilyev <pavel@pavlinux.ru>, linux-kernel@vger.kernel.org, Len Brown <len.brown@intel.com> Subject: [PATCH] ACPI: replace strlen("string") with sizeof("string") -1 Date: Thu, 26 Jul 2012 21:39:38 -0400 [thread overview] Message-ID: <5011F15A.3060007@kernel.org> (raw) In-Reply-To: <Pine.LNX.4.44L0.1206301023540.29029-100000@netrider.rowland.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 <stern@rowland.harvard.edu> Cc: Pavel Vasilyev <pavel@pavlinux.ru> Signed-off-by: Len Brown <len.brown@intel.com> --- 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 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); 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); -- 1.7.12.rc0
next prev parent reply other threads:[~2012-07-27 1:39 UTC|newest] Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top 2012-06-30 5:07 ACPI & Power Management Patches for Linux 3.5-rc4 Len Brown 2012-06-30 5:07 ` [PATCH 1/8] ACPI sysfs.c strlen fix Len Brown 2012-06-30 5:07 ` [PATCH 2/8] ACPI, x86: fix Dell M6600 ACPI reboot regression via DMI Len Brown 2012-06-30 5:07 ` Len Brown 2012-07-06 11:09 ` Ingo Molnar 2012-06-30 5:07 ` [PATCH 3/8] ACPI: Make acpi_skip_timer_override cover all source_irq==0 cases Len Brown 2012-06-30 5:07 ` Len Brown 2012-06-30 5:07 ` [PATCH 4/8] ACPI: Remove one board specific WARN when ignoring timer overriding Len Brown 2012-06-30 5:07 ` Len Brown 2012-06-30 5:07 ` [PATCH 5/8] ACPI: Add a quirk for "AMILO PRO V2030" to ignore the " Len Brown 2012-06-30 5:07 ` Len Brown 2012-06-30 5:07 ` [PATCH 6/8] ACPI, APEI, Avoid too much error reporting in runtime Len Brown 2012-06-30 5:07 ` Len Brown 2012-06-30 5:07 ` [PATCH 7/8] ACPI video: Still use ACPI backlight control if _DOS doesn't exist Len Brown 2012-06-30 5:07 ` [PATCH 8/8] acpi_pad: fix power_saving thread deadlock Len Brown 2012-06-30 5:07 ` Len Brown 2012-06-30 14:25 ` [PATCH 1/8] ACPI sysfs.c strlen fix Alan Stern 2012-06-30 14:25 ` [linux-pm] " Alan Stern 2012-07-27 1:39 ` Len Brown [this message] 2012-07-27 1:39 ` [PATCH] ACPI: replace strlen("string") with sizeof("string") -1 Len Brown 2012-07-30 14:26 ` Ian Campbell 2012-07-30 14:41 ` richard -rw- weinberger 2012-08-06 10:21 ` [linux-pm] " Pavel Machek 2012-08-06 14:36 ` Alan Stern 2012-08-06 14:36 ` [linux-pm] " Alan Stern 2012-08-06 16:00 ` Pavel Vasilyev 2012-08-06 16:28 ` Alan Stern 2012-08-06 16:28 ` [linux-pm] " Alan Stern 2012-08-06 18:47 ` Pavel Vasilyev 2012-08-06 19:59 ` Alan Stern 2012-08-06 19:59 ` [linux-pm] " Alan Stern 2012-08-06 22:57 ` Daniel Taylor 2012-08-06 22:57 ` Daniel Taylor 2012-08-07 13:19 ` Bernd Petrovitsch 2012-08-07 13:19 ` [linux-pm] " Bernd Petrovitsch 2012-08-08 0:59 ` Daniel Taylor 2012-08-08 0:59 ` Daniel Taylor 2012-08-07 1:07 ` Pavel Vasilyev 2012-08-07 1:07 ` Pavel Vasilyev 2012-08-07 17:24 ` Alan Stern 2012-08-07 17:24 ` [linux-pm] " Alan Stern 2012-08-07 23:23 ` Pavel Vasilyev 2012-08-08 1:27 ` Alan Stern 2012-08-08 1:27 ` Alan Stern 2012-08-06 10:26 ` Andreas Schwab
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=5011F15A.3060007@kernel.org \ --to=lenb@kernel.org \ --cc=len.brown@intel.com \ --cc=linux-acpi@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-pm@lists.linux-foundation.org \ --cc=pavel@pavlinux.ru \ --cc=stern@rowland.harvard.edu \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.