Commit 8e36ab69 authored by Thorsten Blum's avatar Thorsten Blum Committed by Greg Kroah-Hartman
Browse files

btrfs: scrub: replace max_t()/min_t() with clamp() in scrub_throttle_dev_io()

[ Upstream commit a7f3dfb8 ]

Replace max_t() followed by min_t() with a single clamp().

As was pointed by David Laight in
https://lore.kernel.org/linux-btrfs/20250906122458.75dfc8f0@pumpkin/


the calculation may overflow u32 when the input value is too large, so
clamp_t() is not used.  In practice the expected values are in range of
megabytes to gigabytes (throughput limit) so the bug would not happen.

Signed-off-by: default avatarThorsten Blum <thorsten.blum@linux.dev>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
[ Use clamp() and add explanation. ]
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 9c50fde9
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment