Skip to content

Commit

Permalink
NFS: silence a harmless uninitialized variable warning
Browse files Browse the repository at this point in the history
kstrtoul() can return -ERANGE so Smatch complains that "num" can be
uninitialized.  We check that it's within bounds so it's not a huge
deal.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
  • Loading branch information
Dan Carpenter authored and amschuma-ntap committed Jul 31, 2018
1 parent 016583d commit 379ebf0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/nfs/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -2899,7 +2899,7 @@ static int param_set_portnr(const char *val, const struct kernel_param *kp)
if (!val)
return -EINVAL;
ret = kstrtoul(val, 0, &num);
if (ret == -EINVAL || num > NFS_CALLBACK_MAXPORTNR)
if (ret || num > NFS_CALLBACK_MAXPORTNR)
return -EINVAL;
*((unsigned int *)kp->arg) = num;
return 0;
Expand Down

0 comments on commit 379ebf0

Please sign in to comment.