Commit a7f3dfb
btrfs: scrub: replace max_t()/min_t() with clamp() in scrub_throttle_dev_io()
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: Thorsten Blum <thorsten.blum@linux.dev>
Reviewed-by: David Sterba <dsterba@suse.com>
[ Use clamp() and add explanation. ]
Signed-off-by: David Sterba <dsterba@suse.com>1 parent 17dc82d commit a7f3dfb
1 file changed
+1
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1369 | 1369 | | |
1370 | 1370 | | |
1371 | 1371 | | |
1372 | | - | |
1373 | | - | |
| 1372 | + | |
1374 | 1373 | | |
1375 | 1374 | | |
1376 | 1375 | | |
| |||
0 commit comments