* [patch] w1: silence an uninitialized variable warning
@ 2016-04-14 9:35 Dan Carpenter
2016-04-27 11:14 ` Evgeniy Polyakov
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2016-04-14 9:35 UTC (permalink / raw)
To: Evgeniy Polyakov; +Cc: linux-kernel, kernel-janitors
If kstrtoint() returns -ERANGE then "tmp" is uninitialized.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/drivers/w1/w1.c b/drivers/w1/w1.c
index 89a7847..bb34362 100644
--- a/drivers/w1/w1.c
+++ b/drivers/w1/w1.c
@@ -335,7 +335,7 @@ static ssize_t w1_master_attribute_store_max_slave_count(struct device *dev,
int tmp;
struct w1_master *md = dev_to_w1_master(dev);
- if (kstrtoint(buf, 0, &tmp) == -EINVAL || tmp < 1)
+ if (kstrtoint(buf, 0, &tmp) || tmp < 1)
return -EINVAL;
mutex_lock(&md->mutex);
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [patch] w1: silence an uninitialized variable warning
2016-04-14 9:35 [patch] w1: silence an uninitialized variable warning Dan Carpenter
@ 2016-04-27 11:14 ` Evgeniy Polyakov
0 siblings, 0 replies; 2+ messages in thread
From: Evgeniy Polyakov @ 2016-04-27 11:14 UTC (permalink / raw)
To: Dan Carpenter; +Cc: linux-kernel, kernel-janitors
Hi Dan
14.04.2016, 12:36, "Dan Carpenter" <dan.carpenter@oracle.com>:
> If kstrtoint() returns -ERANGE then "tmp" is uninitialized.
Looks good to me, please pull it into janitors tree
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Evgeniy Polaykov <zbr@ioremap.net>
> diff --git a/drivers/w1/w1.c b/drivers/w1/w1.c
> index 89a7847..bb34362 100644
> --- a/drivers/w1/w1.c
> +++ b/drivers/w1/w1.c
> @@ -335,7 +335,7 @@ static ssize_t w1_master_attribute_store_max_slave_count(struct device *dev,
> int tmp;
> struct w1_master *md = dev_to_w1_master(dev);
>
> - if (kstrtoint(buf, 0, &tmp) == -EINVAL || tmp < 1)
> + if (kstrtoint(buf, 0, &tmp) || tmp < 1)
> return -EINVAL;
>
> mutex_lock(&md->mutex);
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-04-27 11:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-14 9:35 [patch] w1: silence an uninitialized variable warning Dan Carpenter
2016-04-27 11:14 ` Evgeniy Polyakov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).