mirror of https://github.com/torvalds/linux.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 <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>
This commit is contained in:
parent
593ee49222
commit
c964081d60
|
|
@ -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);
|
ret = acpi_copy_property_array_uint(items, (u64 *)val, nval);
|
||||||
break;
|
break;
|
||||||
case DEV_PROP_STRING:
|
case DEV_PROP_STRING:
|
||||||
nval = min_t(u32, nval, obj->package.count);
|
nval = min(nval, obj->package.count);
|
||||||
if (nval == 0)
|
if (nval == 0)
|
||||||
return -ENODATA;
|
return -ENODATA;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue