mirror of
https://github.com/torvalds/linux.git
synced 2024-12-31 23:31:29 +00:00
staging/lustre/libcfs: Fix kstrtouint return value check fix
Apparently kstrtouint could return not just -EINVAL, but also -ERANGE, so make sure we just check the return value for something negative. Noticed by Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Oleg Drokin <green@linuxhacker.ru> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
96d1865d34
commit
aa66d6f87f
@ -185,7 +185,7 @@ 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 < 0 || num < min || num > max)
|
||||
return -EINVAL;
|
||||
*((unsigned int *)kp->arg) = num;
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user