[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20091113142254.73f82283.akpm@linux-foundation.org>
Date: Fri, 13 Nov 2009 14:22:54 -0800
From: Andrew Morton <akpm@...ux-foundation.org>
To: Joe Perches <joe@...ches.com>
Cc: Zhang Rui <rui.zhang@...el.com>,
Sujith Thomas <sujith.thomas@...el.com>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] drivers/thermal/thermal_sys.c: fix strncmp tests
On Mon, 09 Nov 2009 14:12:49 -0800
Joe Perches <joe@...ches.com> wrote:
> Use strncmp(var, "foo", sizeof("foo") - 1)
> not strncmp(var, "foo", sizeof("foo"))
>
> Signed-off-by: Joe Perches <joe@...ches.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"))
?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists