]> git.karo-electronics.de Git - linux-beck.git/commitdiff
Staging: lustre: lproc_osc: Add check on a variable
authorShivani Bhardwaj <shivanib134@gmail.com>
Sun, 18 Oct 2015 13:20:30 +0000 (18:50 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 25 Oct 2015 01:41:09 +0000 (18:41 -0700)
Variable rc is not tested for negative values and hence a check should
be included. Also, a check for variable val should be introduced.

Signed-off-by: Shivani Bhardwaj <shivanib134@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/lustre/lustre/osc/lproc_osc.c

index cdc7f889564eb6a5da7fd2f5bf27ce33ba657cce..c4d44e70f1d719ba9781fef157575bef92a73a61 100644 (file)
@@ -61,7 +61,9 @@ static ssize_t active_store(struct kobject *kobj, struct attribute *attr,
        unsigned long val;
 
        rc = kstrtoul(buffer, 10, &val);
-       if (rc < 0)
+       if (rc)
+               return rc;
+       if (val > 1)
                return -ERANGE;
 
        /* opposite senses */