]> Gentwo Git Trees - linux/.git/commit
block: use min() instead of min_t()
authorDavid Laight <david.laight.linux@gmail.com>
Wed, 19 Nov 2025 22:41:08 +0000 (22:41 +0000)
committerJens Axboe <axboe@kernel.dk>
Thu, 20 Nov 2025 14:44:29 +0000 (07:44 -0700)
commit9420e720ad192c53c8d2803c5a2313b2d586adbd
tree22b61ad1803a37bec79adfa7cac4da681a4900e5
parente8f0abdd49baacee3886d5827f113514fcd9fd05
block: use min() instead of min_t()

min_t(unsigned int, a, b) casts an 'unsigned long' to 'unsigned int'.
Use min(a, b) instead as it promotes any 'unsigned int' to 'unsigned long'
and so cannot discard significant bits.

In this case the 'unsigned long' value is small enough that the result
is ok.

(Similarly for max_t() and clamp_t().)

Detected by an extra check added to min_t().

Signed-off-by: David Laight <david.laight.linux@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/blk-iocost.c
block/partitions/efi.c