From: David Laight Date: Wed, 19 Nov 2025 22:41:09 +0000 (+0000) Subject: ACPI: property: use min() instead of min_t() X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c964081d602f96f8811f99a938e5f8a164060bd7;p=thirdparty%2Fkernel%2Flinux.git ACPI: property: 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 [ rjw: Subject adjustment ] Link: https://patch.msgid.link/20251119224140.8616-14-david.laight.linux@gmail.com Signed-off-by: Rafael J. Wysocki --- diff --git a/drivers/acpi/property.c b/drivers/acpi/property.c index 57a9c18ec6732..18e90067d5672 100644 --- a/drivers/acpi/property.c +++ b/drivers/acpi/property.c @@ -1280,7 +1280,7 @@ static int acpi_data_prop_read(const struct acpi_device_data *data, ret = acpi_copy_property_array_uint(items, (u64 *)val, nval); break; case DEV_PROP_STRING: - nval = min_t(u32, nval, obj->package.count); + nval = min(nval, obj->package.count); if (nval == 0) return -ENODATA;