From 9ebafb530be42dea90cb698857ac518058346b7b Mon Sep 17 00:00:00 2001 From: Shivani Bhardwaj Date: Sun, 18 Oct 2015 18:50:30 +0530 Subject: [PATCH] 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 --- drivers/staging/lustre/lustre/osc/lproc_osc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 */ -- 2.30.2