Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…l/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
  • Loading branch information
axboe committed Aug 28, 2020
2 parents 79e5dc5 + 6af10a3 commit a433d72
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions drivers/md/raid5.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit a433d72

Please sign in to comment.