Skip to contentSkip to conversation

alignment bug fix in acpi/glue.c

PATCH New Alex Williamson 1 participant 1 message Sep 26, 2005 ACPI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 alignment bug fix in acpi/glue.c

Patch below fixes a bug that shows up as an unaligned access on ia64. acpi_evaluate_integer() is storing 8 bytes into this 4 byte variable.

drivers/acpi/glue.c +5 -5
diff -r db9b9552a2b4 drivers/acpi/glue.c
@@ -96,7 +96,7 @@
 static acpi_status
 do_root_bridge_busnr_callback(struct acpi_resource *resource, void *data)
 {
-	int *busnr = (int *)data;
+	u64 *busnr = (u64 *)data;
 	struct acpi_resource_address64 address;
 
 	if (resource->id != ACPI_RSTYPE_ADDRESS16 &&
@@ -115,13 +115,13 @@
 static int get_root_bridge_busnr(acpi_handle handle)
 {
 	acpi_status status;
-	int bus, bbn;
+	u64 bus;
+	unsigned long bbn;
 	struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
 
 	acpi_get_name(handle, ACPI_FULL_PATHNAME, &buffer);
 
-	status = acpi_evaluate_integer(handle, METHOD_NAME__BBN, NULL,
-				       (unsigned long *)&bbn);
+	status = acpi_evaluate_integer(handle, METHOD_NAME__BBN, NULL, &bbn);
 	if (status == AE_NOT_FOUND) {
 		/* Assume bus = 0 */
 		printk(KERN_INFO PREFIX
@@ -153,7 +153,7 @@
 	}
       exit:
 	acpi_os_free(buffer.pointer);
-	return bbn;
+	return (int)bbn;
 }
 
 static acpi_status

-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download it for free - -and be entered to win a 42" plasma tv or your very own Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php