diff mbox

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

Message ID 1242894335.8523.61.camel@localhost.localdomain (mailing list archive)
State Accepted
Headers show

Commit Message

Zhao, Yakui May 21, 2009, 8:25 a.m. UTC
From: Zhao Yakui <yaui.zhao@intel.com>

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.

Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
---
 include/acpi/acpi_bus.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)



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

Comments

Len Brown May 21, 2009, 6:26 p.m. UTC | #1
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

On Thu, 21 May 2009, yakui_zhao wrote:

> From: Zhao Yakui <yaui.zhao@intel.com>
> 
> 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.
> 
> Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
> ---
>  include/acpi/acpi_bus.h |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> Index: linux-2.6/include/acpi/acpi_bus.h
> ===================================================================
> --- linux-2.6.orig/include/acpi/acpi_bus.h	2009-04-20 09:13:42.000000000 +0800
> +++ linux-2.6/include/acpi/acpi_bus.h	2009-05-21 16:18:25.000000000 +0800
> @@ -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 majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Matthew Garrett May 21, 2009, 7:07 p.m. UTC | #2
On Thu, May 21, 2009 at 02:26:32PM -0400, Len Brown wrote:
> 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.
Zhao, Yakui May 22, 2009, 2:08 a.m. UTC | #3
On Fri, 2009-05-22 at 03:07 +0800, Matthew Garrett wrote:
> On Thu, May 21, 2009 at 02:26:32PM -0400, Len Brown wrote:
> > 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.    
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Len Brown May 27, 2009, 3:55 a.m. UTC | #4
applied

thanks,
Len Brown, Intel Open Source Technology Center

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

Patch

Index: linux-2.6/include/acpi/acpi_bus.h
===================================================================
--- linux-2.6.orig/include/acpi/acpi_bus.h	2009-04-20 09:13:42.000000000 +0800
+++ linux-2.6/include/acpi/acpi_bus.h	2009-05-21 16:18:25.000000000 +0800
@@ -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];