[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150708082837.GL4341@mwanda>
Date: Wed, 8 Jul 2015 11:28:37 +0300
From: Dan Carpenter <dan.carpenter@...cle.com>
To: green@...uxhacker.ru
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
devel@...verdev.osuosl.org,
Andreas Dilger <andreas.dilger@...el.com>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 15/20] staging/lustre/libcfs: get rid of
debugfs/lnet/console_backoff
On Mon, Jul 06, 2015 at 12:48:53PM -0400, green@...uxhacker.ru wrote:
> +static int param_set_uint_minmax(const char *val,
> + const struct kernel_param *kp,
> + unsigned int min, unsigned int max)
> +{
> + unsigned int num;
> + int ret;
> +
> + if (!val)
> + return -EINVAL;
> + ret = kstrtouint(val, 0, &num);
> + if (ret == -EINVAL || num < min || num > max)
^^^
Smatch is smart enough to know that "num" can be uninitialized here on
some paths. It doesn't generate a warning yet because a lot of the
kernel has error paths where we mostly assume things won't fail.
It should probably be:
ret = kstrtouint(val, 0, &num);
if (ret)
return ret;
if (num < min || num > max)
return -EINVAL;
> + return -EINVAL;
> + *((unsigned int *)kp->arg) = num;
> + return 0;
> +}
regards,
dan carpenter
--
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