From: Oleg Drokin Date: Tue, 14 Jul 2015 03:17:57 +0000 (-0400) Subject: staging/lustre/libcfs: Fix kstrtouint return value check fix X-Git-Tag: android-x86-6.0-r1~857^2~708 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=aa66d6f87f300b15ac2efdcde9e198bf5a9020ce;p=android-x86%2Fkernel.git 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 Signed-off-by: Oleg Drokin Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/lustre/lustre/libcfs/debug.c b/drivers/staging/lustre/lustre/libcfs/debug.c index 63468870f230..e93f556fac0d 100644 --- a/drivers/staging/lustre/lustre/libcfs/debug.c +++ b/drivers/staging/lustre/lustre/libcfs/debug.c @@ -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;