Skip to contentSkip to conversation

acpi-build: fix misaligned access

PATCH New Michael S. Tsirkin 1 participant 1 message Mar 12, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 acpi-build: fix misaligned access

clang build reported a misaligned access:

    runtime error: store to misaligned address 0x2b5aa47dfb19 for type
    'uint16_t' (aka 'unsigned short'), which requires 2 byte alignment
    0x2b5aa47dfb19: note: pointer points here
     45 53 54  0b ff ff 5b 80 50 45 4f  52 01 50 45 53 54 01 5b  81 0b 50
    45 4f 52 01 50  45 50 54 08 14

fix this up

---
 hw/i386/acpi-build.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/i386/acpi-build.c +2 -2
index 7ecfd70..4d781a1 100644
@@ -1019,8 +1019,8 @@ build_ssdt(GArray *table_data, GArray *linker,
 
     patch_pci_windows(pci, ssdt_ptr, sizeof(ssdp_misc_aml));
 
-    *(uint16_t *)(ssdt_ptr + *ssdt_isa_pest) =
-        cpu_to_le16(misc->pvpanic_port);
+    ACPI_BUILD_SET_LE(ssdt_ptr, sizeof(ssdp_misc_aml),
+                      ssdt_isa_pest[0], 16, misc->pvpanic_port);
 
     {
         GArray *sb_scope = build_alloc_array();
Signature · 1 line
MST