Re: [PATCH 4/6] md/raid5: make the stripe batch size a module parameter
| Newsgroups | org.kernel.vger.linux-raid |
|---|---|
| Message-ID | <[email protected]> |
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Low] Large unsigned values of `max_stripe_batch` are incorrectly clamped to 1 instead of 32. -- --- Patch [4]: [PATCH 4/6] md/raid5: make the stripe batch size a module parameter --- commit 5fef4dd203fcdfd7a223e9904fbea20f876f265b Author: Hiroshi Nishida <[email protected]> md/raid5: make the stripe batch size a module parameter This commit makes the stripe batch size a configurable module parameter to allow tuning for busy multi-threaded arrays. It synchronizes the dequeue cap and the spawn divisor by tying both to a single per-array variable. > diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c > --- a/drivers/md/raid5.c > +++ b/drivers/md/raid5.c [ ... ] > @@ -7640,6 +7645,10 @@ static struct r5conf *setup_conf(struct mddev *mddev) > !conf->temp_inactive_list) > goto abort; > > + /* Resolve the stripe batch size (see STRIPE_BATCH_* in raid5.h). */ > + conf->max_stripe_batch = clamp_t(int, max_stripe_batch, > + 1, STRIPE_BATCH_MAX); [Severity: Low] Does this code incorrectly clamp large unsigned values to 1 instead of 32? Since max_stripe_batch is defined as an unsigned int, if an administrator provides a value greater than INT_MAX, the clamp_t(int, ...) cast will treat it as a negative number. This will cause it to be clamped to the minimum bound of 1, rather than the intended maximum bound of STRIPE_BATCH_MAX. > + > #if PAGE_SIZE != DEFAULT_STRIPE_SIZE > conf->stripe_size = DEFAULT_STRIPE_SIZE; -- Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=4