Skip to contentSkip to conversation

: ACPI: Change the array size from 5 to 8 for acpi_bus_id

PATCH Applied yakui_zhao 3 participants 5 messages May 21, 2009 – May 27, 2009

Subsystems (2)
lore
Share & tools
lore

yakui_zhao

author
#0 lore raw

PATCH 1/1 : ACPI: Change the array size from 5 to 8 for acpi_bus_id

From: Zhao Yakui <[email protected]>

In fact the following three bytes can't be used when the following data type is unsigned long or unsigned long long.

Change the array size from 5 to 8 for the acpi_bus_id.

---
 include/acpi/acpi_bus.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/acpi/acpi_bus.h +1 -1
Index: linux-2.6/include/acpi/acpi_bus.h
===================================================================
@@ -168,7 +168,7 @@
 
 /* Plug and Play */
 
-typedef char acpi_bus_id[5];
+typedef char acpi_bus_id[8];
 typedef unsigned long acpi_bus_address;
 typedef char acpi_hardware_id[15];
 typedef char acpi_unique_id[9];
reviewer
#1 lore raw

what bad things happen if this patch is not applied -- do some of those strcpy()'s overflow?

what good things happen if it is applied?

are you just eating up the padding because it is there?

thanks,
Len Brown, Intel Open Source Technology Center

Quoted 32 lines · yakui_zhao

From: Zhao Yakui <[email protected]>

In fact the following three bytes can't be used when the following data type is unsigned long or unsigned long long.

Change the array size from 5 to 8 for the acpi_bus_id.

---
 include/acpi/acpi_bus.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-2.6/include/acpi/acpi_bus.h
===================================================================

include/acpi/acpi_bus.h +1 -2
@@ -168,7 +168,7 @@
 
 /* Plug and Play */
 
-typedef char acpi_bus_id[5];
+typedef char acpi_bus_id[8];
 typedef unsigned long acpi_bus_address;
 typedef char acpi_hardware_id[15];
 typedef char acpi_unique_id[9];
 
 
--

To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#2 lore raw
Quoted 2 lines · Len Brown

what bad things happen if this patch is not applied -- do some of those strcpy()'s overflow?

Looks like there'd be issues with the change to the CPU name on systems with lots of CPUs in ACPI.

Signature · 1 line
Matthew Garrett | [email protected]
author
#3 lore raw
Quoted 6 lines · Matthew Garrett
Quoted 2 lines · Len Brown

what bad things happen if this patch is not applied -- do some of those strcpy()'s overflow?

Looks like there'd be issues with the change to the CPU name on systems with lots of CPUs in ACPI.

What Matthew said is right.

On some boxes I want to change the ACPI processor bus id. And the new bus id is generated as the following format:
sprintf(acpi_device_bid(device), "CPU%X", cpu_id)

If the CPU number exceeds 255, the string length will exceed the array size of acpi_bus_id.

Although it doesn't matter, it still looks not very good. The reason that it still can work is that the following three bytes are not used.

So I change the array size of acpi_bus_id from 5 to 8.

Thanks.

Quoted 1 line