]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[romprefix] Avoid unaligned accesses within ROM headers
authorMichael Brown <mcb30@ipxe.org>
Wed, 30 Aug 2017 09:15:25 +0000 (10:15 +0100)
committerMichael Brown <mcb30@ipxe.org>
Wed, 30 Aug 2017 09:15:25 +0000 (10:15 +0100)
Ensure that all headers (PCI, UNDI, PnP, iPXE) are aligned to at least
four bytes, so that all accesses to header fields will be correctly
aligned even when reading directly from the expansion ROM BAR.

Reported-by: Peter von Konigsmark <peter@exablaze.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/arch/x86/prefix/mromprefix.S
src/arch/x86/prefix/romprefix.S

index 568d1c00642f2d4c7507a30e744094364119a771..73a869d909775925dd899f38b380e8fce4ee0ff6 100644 (file)
@@ -492,6 +492,7 @@ mromheader:
        .word   0
        .size   mromheader, . - mromheader
 
+       .align  4
 mpciheader:
        .ascii  "PCIR"                  /* Signature */
        .word   pci_vendor_id           /* Vendor identification */
index f4ca206772bdd3a89191f61a0c819c615753d0ae..978b07b57ba5cf004262b9ecf44ccd04e73e1e18 100644 (file)
@@ -88,6 +88,7 @@ checksum:
        .previous
 
 .ifeqs BUSTYPE, "PCIR"
+       .align  4
 pciheader:
        .ascii  "PCIR"                  /* Signature */
        .word   pci_vendor_id           /* Vendor identification */ 
@@ -183,6 +184,7 @@ prodstr_pci_id:
 
        .globl  undiheader      
        .weak   undiloader
+       .align  4
 undiheader:
        .ascii  "UNDI"                  /* Signature */
        .byte   undiheader_len          /* Length of structure */
@@ -197,6 +199,7 @@ undiheader:
        .equ undiheader_len, . - undiheader
        .size undiheader, . - undiheader
 
+       .align  4
 ipxeheader:
        .ascii  "iPXE"                  /* Signature */
        .byte   ipxeheader_len          /* Length of structure */