summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2017-02-19 00:34:59 +0300
committerAnna Schumaker <Anna.Schumaker@Netapp.com>2017-02-21 18:53:36 +0300
commit9761a2469dc287c6d75ca148f4fc483becbcad88 (patch)
treec59140035afb7f89906f920b488952a3d6a1913e
parent251af29c320d86071664f02c76f0d063a19fefdf (diff)
downloadlinux-9761a2469dc287c6d75ca148f4fc483becbcad88.tar.xz
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: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
-rw-r--r--net/sunrpc/xprtsock.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
index 18b4e7ff8879..5cbabf2c75b2 100644
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -3261,7 +3261,9 @@ static int param_set_uint_minmax(const char *val,
if (!val)
return -EINVAL;
ret = kstrtouint(val, 0, &num);
- if (ret == -EINVAL || num < min || num > max)
+ if (ret)
+ return ret;
+ if (num < min || num > max)
return -EINVAL;
*((unsigned int *)kp->arg) = num;
return 0;