summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2015-06-05 12:22:57 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-06-08 12:39:01 -0700
commitb815555df8ede8aca07ff72d3fbe7727a008620e (patch)
treebace3871e115c4961626cfeaeaf4f76df99ca51c
parent02b310794b8aa34573ef657b694b8f1f18ef4abf (diff)
downloadlinux-stable-b815555df8ede8aca07ff72d3fbe7727a008620e.tar.gz
linux-stable-b815555df8ede8aca07ff72d3fbe7727a008620e.tar.bz2
linux-stable-b815555df8ede8aca07ff72d3fbe7727a008620e.zip
Staging: lustre: ptlrpc: signedness bug in high_priority_ratio_store()
We want to store a non-negative int here. The original code had a check for unsigned long less than zero which is a mistake but also casting from a positive long to an int can result in a negative number. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c b/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c
index c04ae50c2c29..aaaabbf5f1b9 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c
@@ -1035,9 +1035,9 @@ static ssize_t high_priority_ratio_store(struct kobject *kobj,
struct ptlrpc_service *svc = container_of(kobj, struct ptlrpc_service,
srv_kobj);
int rc;
- unsigned long val;
+ int val;
- rc = kstrtoul(buffer, 10, &val);
+ rc = kstrtoint(buffer, 10, &val);
if (rc < 0)
return rc;