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-Tag: KARO-TX6UL-2015-11-03~34^2~387 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=9ebafb530be42dea90cb698857ac518058346b7b;p=karo-tx-linux.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 */