]> git.karo-electronics.de Git - linux-beck.git/commitdiff
staging/lustre/libcfs: Fix kstrtouint return value check fix
authorOleg Drokin <green@linuxhacker.ru>
Tue, 14 Jul 2015 03:17:57 +0000 (23:17 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 14 Jul 2015 03:52:55 +0000 (20:52 -0700)
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>
drivers/staging/lustre/lustre/libcfs/debug.c

index 63468870f230f60f39e381726d70fed077c2c6f0..e93f556fac0dde68da054320fc320815c1025258 100644 (file)
@@ -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;