Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

[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>

authored by

Peter Chubb and committed by
Linus Torvalds
51b190b3 11909d64

+4 -4
+4 -4
drivers/acpi/glue.c
··· 96 96 static acpi_status 97 97 do_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 100 struct acpi_resource_address64 address; 101 101 102 102 if (resource->id != ACPI_RSTYPE_ADDRESS16 && ··· 115 115 static int get_root_bridge_busnr(acpi_handle handle) 116 116 { 117 117 acpi_status status; 118 - int bus, bbn; 118 + unsigned long bus, bbn; 119 119 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; 120 120 121 121 acpi_get_name(handle, ACPI_FULL_PATHNAME, &buffer); 122 122 123 123 status = acpi_evaluate_integer(handle, METHOD_NAME__BBN, NULL, 124 - (unsigned long *)&bbn); 124 + &bbn); 125 125 if (status == AE_NOT_FOUND) { 126 126 /* Assume bus = 0 */ 127 127 printk(KERN_INFO PREFIX ··· 153 153 } 154 154 exit: 155 155 acpi_os_free(buffer.pointer); 156 - return bbn; 156 + return (int)bbn; 157 157 } 158 158 159 159 static acpi_status