From: Andrew Morton <akpm@linux-foundation.org>
To: Joe Perches <joe@perches.com>
Cc: Zhang Rui <rui.zhang@intel.com>,
Sujith Thomas <sujith.thomas@intel.com>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] drivers/thermal/thermal_sys.c: fix strncmp tests
Date: Fri, 13 Nov 2009 14:22:54 -0800 [thread overview]
Message-ID: <20091113142254.73f82283.akpm@linux-foundation.org> (raw)
In-Reply-To: <1257804769.12852.22.camel@Joe-Laptop.home>
On Mon, 09 Nov 2009 14:12:49 -0800
Joe Perches <joe@perches.com> wrote:
> Use strncmp(var, "foo", sizeof("foo") - 1)
> not strncmp(var, "foo", sizeof("foo"))
>
> Signed-off-by: Joe Perches <joe@perches.com>
>
> diff --git a/drivers/thermal/thermal_sys.c b/drivers/thermal/thermal_sys.c
> index 4e83c29..c35d538 100644
> --- a/drivers/thermal/thermal_sys.c
> +++ b/drivers/thermal/thermal_sys.c
> @@ -147,9 +147,9 @@ mode_store(struct device *dev, struct device_attribute *attr,
> if (!tz->ops->set_mode)
> return -EPERM;
>
> - if (!strncmp(buf, "enabled", sizeof("enabled")))
> + if (!strncmp(buf, "enabled", sizeof("enabled") - 1))
How about
if (!strcmp(buf, "enabled"))
?
next prev parent reply other threads:[~2009-11-13 22:22 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-09 22:12 Joe Perches
2009-11-13 22:22 ` Andrew Morton [this message]
2009-11-13 23:37 ` Joe Perches
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=20091113142254.73f82283.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=joe@perches.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rui.zhang@intel.com \
--cc=sujith.thomas@intel.com \
/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: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®