aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2020-08-28 07:52:02 -0600
committerJens Axboe <axboe@kernel.dk>2020-08-28 07:52:02 -0600
commita433d7217feab712ff69ef5cc2a86f95ed1aca40 (patch)
treea89dd520a4a67f44838f946d7419228da345a44d
parent79e5dc59e2974a48764269fa9ff544ae8ffe3338 (diff)
parent6af10a33c501b0b5878476501143c2cfbbfd63a2 (diff)
downloadlinux-visconti-a433d7217feab712ff69ef5cc2a86f95ed1aca40.tar.gz
Merge branch 'md-fixes' of https://git.kernel.org/pub/scm/linux/kernel/git/song/md into block-5.9
Pull MD fix from Song. * 'md-fixes' of https://git.kernel.org/pub/scm/linux/kernel/git/song/md: md/raid5: make sure stripe_size as power of two
-rw-r--r--drivers/md/raid5.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index ef0fd4830803f0..a095c7a4cd7cbf 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -6514,9 +6514,12 @@ raid5_store_stripe_size(struct mddev *mddev, const char *page, size_t len)
/*
* The value should not be bigger than PAGE_SIZE. It requires to
- * be multiple of DEFAULT_STRIPE_SIZE.
+ * be multiple of DEFAULT_STRIPE_SIZE and the value should be power
+ * of two.
*/
- if (new % DEFAULT_STRIPE_SIZE != 0 || new > PAGE_SIZE || new == 0)
+ if (new % DEFAULT_STRIPE_SIZE != 0 ||
+ new > PAGE_SIZE || new == 0 ||
+ new != roundup_pow_of_two(new))
return -EINVAL;
err = mddev_lock(mddev);