Re: [PATCH 29/44] drivers/xen: use min() instead of min_t()

From: Jürgen Groß

Date: Thu Nov 20 2025 - 03:13:34 EST


On 19.11.25 23:41, david.laight.linux@xxxxxxxxx wrote:
From: David Laight <david.laight.linux@xxxxxxxxx>

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@xxxxxxxxx>

Reviewed-by: Juergen Gross <jgross@xxxxxxxx>

I'll take this patch through the Xen tree.


Juergen

Attachment: OpenPGP_0xB0DE9DD628BF132F.asc
Description: OpenPGP public key

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature