aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorPeter Chubb <peterc@gelato.unsw.edu.au>2005-10-20 01:45:14 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2005-10-20 02:04:31 -0400
commit51b190b304bbeb1090ba20b0623d39917fa62997 (patch)
treeff136b65291671ca93f65aff101c1b5ead5f9a9b /drivers
parent11909d64389c24b409e20f0eeafdc262e0a55788 (diff)
[PATCH] `unaligned access' in acpi get_root_bridge_busnr()
In drivers/acpi/glue.c the address of an integer is cast to the address of an unsigned long. This breaks on systems where a long is larger than an int --- for a start the int can be misaligned; for a second the assignment through the pointer will overwrite part of the next variable. Signed-off-by: Peter Chubb <peterc@gelato.unsw.edu.au> Acked-by: "Brown, Len" <len.brown@intel.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/acpi/glue.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/acpi/glue.c b/drivers/acpi/glue.c
index e36c5da2b31a..3937adf4e5e5 100644
--- a/drivers/acpi/glue.c
+++ b/drivers/acpi/glue.c
@@ -96,7 +96,7 @@ struct acpi_find_pci_root {
96static acpi_status 96static acpi_status
97do_root_bridge_busnr_callback(struct acpi_resource *resource, void *data) 97do_root_bridge_busnr_callback(struct acpi_resource *resource, void *data)
98{ 98{
99 int *busnr = (int *)data; 99 unsigned long *busnr = (unsigned long *)data;
100 struct acpi_resource_address64 address; 100 struct acpi_resource_address64 address;
101 101
102 if (resource->id != ACPI_RSTYPE_ADDRESS16 && 102 if (resource->id != ACPI_RSTYPE_ADDRESS16 &&
@@ -115,13 +115,13 @@ do_root_bridge_busnr_callback(struct acpi_resource *resource, void *data)
115static int get_root_bridge_busnr(acpi_handle handle) 115static int get_root_bridge_busnr(acpi_handle handle)
116{ 116{
117 acpi_status status; 117 acpi_status status;
118 int bus, bbn; 118 unsigned long bus, bbn;
119 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; 119 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
120 120
121 acpi_get_name(handle, ACPI_FULL_PATHNAME, &buffer); 121 acpi_get_name(handle, ACPI_FULL_PATHNAME, &buffer);
122 122
123 status = acpi_evaluate_integer(handle, METHOD_NAME__BBN, NULL, 123 status = acpi_evaluate_integer(handle, METHOD_NAME__BBN, NULL,
124 (unsigned long *)&bbn); 124 &bbn);
125 if (status == AE_NOT_FOUND) { 125 if (status == AE_NOT_FOUND) {
126 /* Assume bus = 0 */ 126 /* Assume bus = 0 */
127 printk(KERN_INFO PREFIX 127 printk(KERN_INFO PREFIX
@@ -153,7 +153,7 @@ static int get_root_bridge_busnr(acpi_handle handle)
153 } 153 }
154 exit: 154 exit:
155 acpi_os_free(buffer.pointer); 155 acpi_os_free(buffer.pointer);
156 return bbn; 156 return (int)bbn;
157} 157}
158 158
159static acpi_status 159static acpi_status