ACPI: Property: Fix type detection of unified integer reading functions
PATCH 1/1 ACPI: Property: Fix type detection of unified integer reading functions
The current code expects the type of the value to be an integer type, instead the value passed to the macro is a pointer.
Ensure the size comparison uses the correct pointer type to choose the max value, instead of using the integer type.
--- drivers/acpi/property.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/acpi/property.c +4 -4
@@ -1043,10 +1043,10 @@ static int acpi_data_prop_read_single(const struct acpi_device_data *data,break ; \ } \if (__items[i].integer.value > _Generic(__val, \ -u8 :U8_MAX , \ -u16 :U16_MAX , \ -u32 :U32_MAX , \ -u64 :U64_MAX , \ +u8 *:U8_MAX , \ +u16 *:U16_MAX , \ +u32 *:U32_MAX , \ +u64 *:U64_MAX , \ default: 0U)) { \ ret = -EOVERFLOW ; \break ; \
Signature · 1 line
2.34.1
Hi Stefan,
Quoted 21 lines · Stefan Binding
The current code expects the type of the value to be an integer type, instead the value passed to the macro is a pointer.
Ensure the size comparison uses the correct pointer type to choose the max value, instead of using the integer type.Fixes 923044133367 ("ACPI: property: Unify integer value reading functions")Signed-off-by Stefan Binding <[email protected]>--- drivers/acpi/property.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)drivers/acpi/property.c +0
-1@@ -1043,10 +1043,10 @@ static int acpi_data_prop_read_single(const struct acpi_device_data *data,break ; \ } \ if (__items[i].integer.value > _Generic(__val, \ - u8: U8_MAX, \
drivers/acpi/property.c static int acpi_data_prop_read_single(const struct acpi_device_data *data, · line 1052
Quoted 10 lines
drivers/acpi/property.c +4
-3- u16: U16_MAX, \ - u32: U32_MAX, \ - u64: U64_MAX, \ + u8 *: U8_MAX, \ + u16 *: U16_MAX, \ + u32 *: U32_MAX, \ + u64 *: U64_MAX, \ default: 0U)) { \ ret = -EOVERFLOW ; \break ; \
Thanks for the patch.
I prefer this fix over the other as it uses the pointer type (rather than value at a given index). Both have the same effect though.
Signature · 3 lines
Kind regards, Sakari Ailus
Sakari Ailus
Tested-byQuoted 1 line · Sakari Ailus
Reviewed-by Sakari Ailus <[email protected]>
Should have been:
Signature · 1 line
Sakari Ailus
Quoted 3 lines · Sakari Ailus
Quoted 1 line · Sakari Ailus
Reviewed-by Sakari Ailus <[email protected]>
This is still OK if you have reviewed the patch.
Quoted 3 lines
Should have been:
Tested-by Sakari Ailus <[email protected]>
Applied as 6.0-rc material, thanks!
Quoted 8 lines
The current code expects the type of the value to be an integer type, instead the value passed to the macro is a pointer.
Ensure the size comparison uses the correct pointer type to choose the max value, instead of using the integer type.Fixes 923044133367 ("ACPI: property: Unify integer value reading functions")Signed-off-by Stefan Binding <[email protected]>
Can we get this queued up and sent out please? This is breaking some ACPI arm64 systems, which use device properties for their MAC addresses.
Some grumbling about the original patch below.
Quoted 11 lines
--- drivers/acpi/property.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)drivers/acpi/property.c +0
-0@@ -1043,10 +1043,10 @@ static int acpi_data_prop_read_single(const struct acpi_device_data *data,break ; \ } \
drivers/acpi/property.c static int acpi_data_prop_read_single(const struct acpi_device_data *data, · line 1050
Quoted 10 lines
drivers/acpi/property.c +4
-4if (__items[i].integer.value > _Generic(__val, \ -u8 :U8_MAX , \ -u16 :U16_MAX , \ -u32 :U32_MAX , \ -u64 :U64_MAX , \ +u8 *:U8_MAX , \ +u16 *:U16_MAX , \ +u32 *:U32_MAX , \ +u64 *:U64_MAX , \ default: 0U)) { \
Why is there a default here? Having one is what hides the fact that the patch was completely broken.
drivers/acpi/property.c static int acpi_data_prop_read_single(const struct acpi_device_data *data, · line 1052
Quoted 3 lines
drivers/acpi/property.c +0
-0ret = -EOVERFLOW ; \break ; \
Also, I must ask: given how broken the original patch is, I suppose no testing whatsoever was done?
Thanks,
Ard.
Rafael J. Wysocki
maintainerQuoted 6 lines · Ard Biesheuvel
Quoted 6 lines
The current code expects the type of the value to be an integer type, instead the value passed to the macro is a pointer.
Ensure the size comparison uses the correct pointer type to choose the max value, instead of using the integer type.
Quoted 8 lines
Quoted 3 lines
Fixes 923044133367 ("ACPI: property: Unify integer value reading functions")Signed-off-by Stefan Binding <[email protected]>Acked-by Ard Biesheuvel <[email protected]>Can we get this queued up and sent out please? This is breaking some ACPI arm64 systems, which use device properties for their MAC addresses.
It is in my queue for -rc3.
Quoted 17 lines
Some grumbling about the original patch below.
Quoted 15 lines
--- drivers/acpi/property.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)drivers/acpi/property.c +0
-3@@ -1043,10 +1043,10 @@ static int acpi_data_prop_read_single(const struct acpi_device_data *data,break ; \ } \ if (__items[i].integer.value > _Generic(__val, \ - u8: U8_MAX, \ - u16: U16_MAX, \ - u32: U32_MAX, \
Quoted 8 lines
drivers/acpi/property.c static int acpi_data_prop_read_single(const struct acpi_device_data *data, · line 1050
Quoted 6 lines
drivers/acpi/property.c +4
-1- u64: U64_MAX, \ + u8 *: U8_MAX, \ + u16 *: U16_MAX, \ + u32 *: U32_MAX, \ + u64 *: U64_MAX, \ default: 0U)) { \Why is there a default here? Having one is what hides the fact that the patch was completely broken.
Sakari?
Quoted 5 lines
drivers/acpi/property.c static int acpi_data_prop_read_single(const struct acpi_device_data *data, · line 1052
Quoted 3 lines
drivers/acpi/property.c +0
-0ret = -EOVERFLOW ; \break ; \Also, I must ask: given how broken the original patch is, I suppose no testing whatsoever was done?
Hi Ard,
Quoted 31 lines · Ard Biesheuvel
Quoted 8 lines
The current code expects the type of the value to be an integer type, instead the value passed to the macro is a pointer.
Ensure the size comparison uses the correct pointer type to choose the max value, instead of using the integer type.Fixes 923044133367 ("ACPI: property: Unify integer value reading functions")Signed-off-by Stefan Binding <[email protected]>Acked-by Ard Biesheuvel <[email protected]>Can we get this queued up and sent out please? This is breaking some ACPI arm64 systems, which use device properties for their MAC addresses.
Some grumbling about the original patch below.
Quoted 15 lines
--- drivers/acpi/property.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)drivers/acpi/property.c +0
-3@@ -1043,10 +1043,10 @@ static int acpi_data_prop_read_single(const struct acpi_device_data *data,break ; \ } \ if (__items[i].integer.value > _Generic(__val, \ - u8: U8_MAX, \ - u16: U16_MAX, \ - u32: U32_MAX, \
Quoted 8 lines
drivers/acpi/property.c static int acpi_data_prop_read_single(const struct acpi_device_data *data, · line 1050
Quoted 6 lines
drivers/acpi/property.c +4
-1- u64: U64_MAX, \ + u8 *: U8_MAX, \ + u16 *: U16_MAX, \ + u32 *: U32_MAX, \ + u64 *: U64_MAX, \ default: 0U)) { \Why is there a default here? Having one is what hides the fact that the patch was completely broken.
I think the default can be removed. I can send a patch.
Quoted 6 lines
drivers/acpi/property.c static int acpi_data_prop_read_single(const struct acpi_device_data *data, · line 1052
Quoted 4 lines
drivers/acpi/property.c +0
-0ret = -EOVERFLOW ; \break ; \Also, I must ask: given how broken the original patch is, I suppose no testing whatsoever was done?
Testing was done but it failed to uncover this. It seems all the properties in the system were of buffer type.
Please wrap your lines before 80. It'll be easier to read that way.
Signature · 3 lines
Kind regards, Sakari Ailus
Rafael J. Wysocki
maintainerQuoted 44 lines · Sakari Ailus
Hi Ard,
Quoted 31 lines · Ard Biesheuvel
Quoted 8 lines
The current code expects the type of the value to be an integer type, instead the value passed to the macro is a pointer.
Ensure the size comparison uses the correct pointer type to choose the max value, instead of using the integer type.Fixes 923044133367 ("ACPI: property: Unify integer value reading functions")Signed-off-by Stefan Binding <[email protected]>Acked-by Ard Biesheuvel <[email protected]>Can we get this queued up and sent out please? This is breaking some ACPI arm64 systems, which use device properties for their MAC addresses.
Some grumbling about the original patch below.
Quoted 15 lines
--- drivers/acpi/property.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)drivers/acpi/property.c +0
-3@@ -1043,10 +1043,10 @@ static int acpi_data_prop_read_single(const struct acpi_device_data *data,break ; \ } \ if (__items[i].integer.value > _Generic(__val, \ - u8: U8_MAX, \ - u16: U16_MAX, \ - u32: U32_MAX, \Quoted 8 lines
drivers/acpi/property.c static int acpi_data_prop_read_single(const struct acpi_device_data *data, · line 1050
Quoted 6 lines
drivers/acpi/property.c +4
-1- u64: U64_MAX, \ + u8 *: U8_MAX, \ + u16 *: U16_MAX, \ + u32 *: U32_MAX, \ + u64 *: U64_MAX, \ default: 0U)) { \Why is there a default here? Having one is what hides the fact that the patch was completely broken.
Quoted 1 line
I think the default can be removed. I can send a patch.
Please do.