From aa66d6f87f300b15ac2efdcde9e198bf5a9020ce Mon Sep 17 00:00:00 2001 From: Oleg Drokin Date: Mon, 13 Jul 2015 23:17:57 -0400 Subject: [PATCH] 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 --- drivers/staging/lustre/lustre/libcfs/debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; -- 2.34.1