Re: [PATCH] ACPI: sysfs: Define the variable gpe from u8 to u16 to avoid endless loop in function apci_gpe_apply_masked_gpes()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





在 2019/11/22 18:03, Rafael J. Wysocki 写道:
On Fri, Nov 22, 2019 at 3:52 AM chenxiang <chenxiang66@xxxxxxxxxxxxx> wrote:
From: Xiang Chen <chenxiang66@xxxxxxxxxxxxx>

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@xxxxxxxxxxxxx>
---
  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

.






[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux