From: Shivani Bhardwaj Date: Sun, 18 Oct 2015 13:20:30 +0000 (+0530) Subject: Staging: lustre: lproc_osc: Add check on a variable X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=9ebafb530be42dea90cb698857ac518058346b7b;p=openwrt%2Fstaging%2Fblogic.git Staging: lustre: lproc_osc: Add check on a variable 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 Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/lustre/lustre/osc/lproc_osc.c b/drivers/staging/lustre/lustre/osc/lproc_osc.c index cdc7f889564e..c4d44e70f1d7 100644 --- a/drivers/staging/lustre/lustre/osc/lproc_osc.c +++ b/drivers/staging/lustre/lustre/osc/lproc_osc.c @@ -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 */