]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
drivers/usb/storage: use min() instead of min_t()
authorDavid Laight <david.laight.linux@gmail.com>
Wed, 19 Nov 2025 22:41:24 +0000 (22:41 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 21 Nov 2025 14:17:24 +0000 (15:17 +0100)
commitde7275cbc6171ce777fae7af444cf8efaf14258b
treea679160fff57ff8de08395c5382860ce02c313db
parenta5160af78be7fcf3ade6caab0a14e349560c96d7
drivers/usb/storage: 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.

Detected by an extra check added to min_t().

Signed-off-by: David Laight <david.laight.linux@gmail.com>
Link: https://patch.msgid.link/20251119224140.8616-29-david.laight.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/storage/protocol.c