diff options
author | Shaohua Li <shli@fb.com> | 2017-09-21 20:03:52 +0200 |
---|---|---|
committer | Shaohua Li <shli@fb.com> | 2017-09-28 05:08:44 +0200 |
commit | 7d5d7b5058fbd638914e42504677141a69f43011 (patch) | |
tree | 0291889463a5dbd06ae840cdb9e553f76499fcd1 /drivers/md/raid5.c | |
parent | dm-raid: fix a race condition in request handling (diff) | |
download | linux-7d5d7b5058fbd638914e42504677141a69f43011.tar.xz linux-7d5d7b5058fbd638914e42504677141a69f43011.zip |
md/raid5: cap worker count
static checker reports a potential integer overflow. Cap the worker count to
avoid the overflow.
Reported:-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Shaohua Li <shli@fb.com>
Diffstat (limited to '')
-rw-r--r-- | drivers/md/raid5.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 076409455b60..928e24a07133 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c @@ -6575,14 +6575,17 @@ static ssize_t raid5_store_group_thread_cnt(struct mddev *mddev, const char *page, size_t len) { struct r5conf *conf; - unsigned long new; + unsigned int new; int err; struct r5worker_group *new_groups, *old_groups; int group_cnt, worker_cnt_per_group; if (len >= PAGE_SIZE) return -EINVAL; - if (kstrtoul(page, 10, &new)) + if (kstrtouint(page, 10, &new)) + return -EINVAL; + /* 8192 should be big enough */ + if (new > 8192) return -EINVAL; err = mddev_lock(mddev); |