Skip to content

Commit c964081

Browse files
David Laightrafaeljw
authored andcommitted
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 <david.laight.linux@gmail.com> [ rjw: Subject adjustment ] Link: https://patch.msgid.link/20251119224140.8616-14-david.laight.linux@gmail.com Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent 593ee49 commit c964081

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/acpi/property.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1280,7 +1280,7 @@ static int acpi_data_prop_read(const struct acpi_device_data *data,
12801280
ret = acpi_copy_property_array_uint(items, (u64 *)val, nval);
12811281
break;
12821282
case DEV_PROP_STRING:
1283-
nval = min_t(u32, nval, obj->package.count);
1283+
nval = min(nval, obj->package.count);
12841284
if (nval == 0)
12851285
return -ENODATA;
12861286

0 commit comments

Comments
 (0)