Commit 9761a246 authored by Dan Carpenter's avatar Dan Carpenter Committed by Anna Schumaker

sunrpc: silence uninitialized variable warning

kstrtouint() can return a couple different error codes so the check for
"ret == -EINVAL" is wrong and static analysis tools correctly complain
that we can use "num" without initializing it.  It's not super harmful
because we check the bounds.  But it's also easy enough to fix.
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarAnna Schumaker <Anna.Schumaker@Netapp.com>
parent 251af29c
...@@ -3261,7 +3261,9 @@ static int param_set_uint_minmax(const char *val, ...@@ -3261,7 +3261,9 @@ static int param_set_uint_minmax(const char *val,
if (!val) if (!val)
return -EINVAL; return -EINVAL;
ret = kstrtouint(val, 0, &num); ret = kstrtouint(val, 0, &num);
if (ret == -EINVAL || num < min || num > max) if (ret)
return ret;
if (num < min || num > max)
return -EINVAL; return -EINVAL;
*((unsigned int *)kp->arg) = num; *((unsigned int *)kp->arg) = num;
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment