Pack the fields in the coreboot table entries. These entries are part of the coreboot ABI, so they don't follow regular calling conventions. For example, fields of type u64 are aligned to boundaries of 4 byte instead of 8. [1]
So far this has not been a problem. In the future, padding bytes should be added where explicit alignment is required. Signed-off-by: Thomas Zimmermann <[email protected]> Link: https://github.com/coreboot/coreboot/blob/main/payloads/libpayload/include/coreboot_tables.h#L96 # [1] --- drivers/firmware/google/coreboot_table.c | 2 +- include/linux/coreboot.h | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/firmware/google/coreboot_table.c b/drivers/firmware/google/coreboot_table.c index c769631ea15d..e21b013b19e7 100644 --- a/drivers/firmware/google/coreboot_table.c +++ b/drivers/firmware/google/coreboot_table.c @@ -30,7 +30,7 @@ struct coreboot_table_header { u32 table_bytes; u32 table_checksum; u32 table_entries; -}; +} __packed; #define CB_DEV(d) container_of(d, struct coreboot_device, dev) #define CB_DRV(d) container_of_const(d, struct coreboot_driver, drv) diff --git a/include/linux/coreboot.h b/include/linux/coreboot.h index 48705b439c6e..514c95f9d0e3 100644 --- a/include/linux/coreboot.h +++ b/include/linux/coreboot.h @@ -12,6 +12,7 @@ #ifndef _LINUX_COREBOOT_H #define _LINUX_COREBOOT_H +#include <linux/compiler_attributes.h> #include <linux/types.h> /* List of coreboot entry structures that is used */ @@ -23,7 +24,7 @@ struct coreboot_table_entry { u32 tag; u32 size; -}; +} __packed; /* Points to a CBMEM entry */ struct lb_cbmem_ref { @@ -31,7 +32,7 @@ struct lb_cbmem_ref { u32 size; u64 cbmem_addr; -}; +} __packed; /* Corresponds to LB_TAG_CBMEM_ENTRY */ struct lb_cbmem_entry { @@ -41,7 +42,7 @@ struct lb_cbmem_entry { u64 address; u32 entry_size; u32 id; -}; +} __packed; /* Describes framebuffer setup by coreboot */ struct lb_framebuffer { @@ -61,6 +62,6 @@ struct lb_framebuffer { u8 blue_mask_size; u8 reserved_mask_pos; u8 reserved_mask_size; -}; +} __packed; #endif /* _LINUX_COREBOOT_H */ -- 2.52.0
