All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ACPI: sysfs: Define the variable gpe from u8 to u16 to avoid endless loop in function apci_gpe_apply_masked_gpes()
@ 2019-11-22  2:49 chenxiang
  2019-11-22 10:03 ` Rafael J. Wysocki
  0 siblings, 1 reply; 3+ messages in thread
From: chenxiang @ 2019-11-22  2:49 UTC (permalink / raw)
  To: rjw, yeyunfeng; +Cc: linuxarm, linux-acpi, john.garry, Xiang Chen

From: Xiang Chen <chenxiang66@hisilicon.com>

After the patch (eb09878e1301 ("ACPI: sysfs: Change ACPI_MASKABLE_GPE_MAX to 0x100")),
the macro ACPI_MASKABLE_GPE_MAX is changed from 0xFF to 0x100. So in function
apci_gpe_apply_masked_gpes(), the variable gpe may reach 0x100 but it is
defined as u8, so it will be 0 when reaching 0x100. If the bitmap
acpi_masked_gpes_map are all 0s, it will loop all the times.

To solve endless loop in the function, define the variable gpe from u8 to u16.

Fixes: eb09878e1301 ("ACPI: sysfs: Change ACPI_MASKABLE_GPE_MAX to 0x100")
Signed-off-by: Xiang Chen <chenxiang66@hisilicon.com>
---
 drivers/acpi/sysfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/acpi/sysfs.c b/drivers/acpi/sysfs.c
index 0a83ce1..c60d2c6 100644
--- a/drivers/acpi/sysfs.c
+++ b/drivers/acpi/sysfs.c
@@ -838,7 +838,7 @@ void __init acpi_gpe_apply_masked_gpes(void)
 {
 	acpi_handle handle;
 	acpi_status status;
-	u8 gpe;
+	u16 gpe;
 
 	for_each_set_bit(gpe, acpi_masked_gpes_map, ACPI_MASKABLE_GPE_MAX) {
 		status = acpi_get_gpe_device(gpe, &handle);
-- 
2.8.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] ACPI: sysfs: Define the variable gpe from u8 to u16 to avoid endless loop in function apci_gpe_apply_masked_gpes()
  2019-11-22  2:49 [PATCH] ACPI: sysfs: Define the variable gpe from u8 to u16 to avoid endless loop in function apci_gpe_apply_masked_gpes() chenxiang
@ 2019-11-22 10:03 ` Rafael J. Wysocki
  2019-11-25  1:29   ` chenxiang (M)
  0 siblings, 1 reply; 3+ messages in thread
From: Rafael J. Wysocki @ 2019-11-22 10:03 UTC (permalink / raw)
  To: chenxiang
  Cc: Rafael J. Wysocki, Yunfeng Ye, Linuxarm, ACPI Devel Maling List,
	John Garry

On Fri, Nov 22, 2019 at 3:52 AM chenxiang <chenxiang66@hisilicon.com> wrote:
>
> From: Xiang Chen <chenxiang66@hisilicon.com>
>
> After the patch (eb09878e1301 ("ACPI: sysfs: Change ACPI_MASKABLE_GPE_MAX to 0x100")),
> the macro ACPI_MASKABLE_GPE_MAX is changed from 0xFF to 0x100. So in function
> apci_gpe_apply_masked_gpes(), the variable gpe may reach 0x100 but it is
> defined as u8, so it will be 0 when reaching 0x100. If the bitmap
> acpi_masked_gpes_map are all 0s, it will loop all the times.
>
> To solve endless loop in the function, define the variable gpe from u8 to u16.
>
> Fixes: eb09878e1301 ("ACPI: sysfs: Change ACPI_MASKABLE_GPE_MAX to 0x100")

This commit has been dropped.

I have a new version of it queued up with the u16 change below folded it.

Thanks!

> Signed-off-by: Xiang Chen <chenxiang66@hisilicon.com>
> ---
>  drivers/acpi/sysfs.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/acpi/sysfs.c b/drivers/acpi/sysfs.c
> index 0a83ce1..c60d2c6 100644
> --- a/drivers/acpi/sysfs.c
> +++ b/drivers/acpi/sysfs.c
> @@ -838,7 +838,7 @@ void __init acpi_gpe_apply_masked_gpes(void)
>  {
>         acpi_handle handle;
>         acpi_status status;
> -       u8 gpe;
> +       u16 gpe;
>
>         for_each_set_bit(gpe, acpi_masked_gpes_map, ACPI_MASKABLE_GPE_MAX) {
>                 status = acpi_get_gpe_device(gpe, &handle);
> --
> 2.8.1
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ACPI: sysfs: Define the variable gpe from u8 to u16 to avoid endless loop in function apci_gpe_apply_masked_gpes()
  2019-11-22 10:03 ` Rafael J. Wysocki
@ 2019-11-25  1:29   ` chenxiang (M)
  0 siblings, 0 replies; 3+ messages in thread
From: chenxiang (M) @ 2019-11-25  1:29 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Rafael J. Wysocki, Yunfeng Ye, Linuxarm, ACPI Devel Maling List,
	John Garry



在 2019/11/22 18:03, Rafael J. Wysocki 写道:
> On Fri, Nov 22, 2019 at 3:52 AM chenxiang <chenxiang66@hisilicon.com> wrote:
>> From: Xiang Chen <chenxiang66@hisilicon.com>
>>
>> After the patch (eb09878e1301 ("ACPI: sysfs: Change ACPI_MASKABLE_GPE_MAX to 0x100")),
>> the macro ACPI_MASKABLE_GPE_MAX is changed from 0xFF to 0x100. So in function
>> apci_gpe_apply_masked_gpes(), the variable gpe may reach 0x100 but it is
>> defined as u8, so it will be 0 when reaching 0x100. If the bitmap
>> acpi_masked_gpes_map are all 0s, it will loop all the times.
>>
>> To solve endless loop in the function, define the variable gpe from u8 to u16.
>>
>> Fixes: eb09878e1301 ("ACPI: sysfs: Change ACPI_MASKABLE_GPE_MAX to 0x100")
> This commit has been dropped.
>
> I have a new version of it queued up with the u16 change below folded it.

Ok, thanks!

>
> Thanks!
>
>> Signed-off-by: Xiang Chen <chenxiang66@hisilicon.com>
>> ---
>>   drivers/acpi/sysfs.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/acpi/sysfs.c b/drivers/acpi/sysfs.c
>> index 0a83ce1..c60d2c6 100644
>> --- a/drivers/acpi/sysfs.c
>> +++ b/drivers/acpi/sysfs.c
>> @@ -838,7 +838,7 @@ void __init acpi_gpe_apply_masked_gpes(void)
>>   {
>>          acpi_handle handle;
>>          acpi_status status;
>> -       u8 gpe;
>> +       u16 gpe;
>>
>>          for_each_set_bit(gpe, acpi_masked_gpes_map, ACPI_MASKABLE_GPE_MAX) {
>>                  status = acpi_get_gpe_device(gpe, &handle);
>> --
>> 2.8.1
>>
> .
>



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-11-25  1:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-22  2:49 [PATCH] ACPI: sysfs: Define the variable gpe from u8 to u16 to avoid endless loop in function apci_gpe_apply_masked_gpes() chenxiang
2019-11-22 10:03 ` Rafael J. Wysocki
2019-11-25  1:29   ` chenxiang (M)

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.