[PATCH 2/2] efi_loader: Fix warnings on unaligned accesses
Ilias Apalodimas
ilias.apalodimas at linaro.org
Thu Apr 6 21:37:07 CEST 2023
Tom reports that when building with clang we see this warning:
field guid within 'struct efi_hii_keyboard_layout' is less aligned than 'efi_guid_t' and is usually due to 'struct efi_hii_keyboard_layout' being packed, which can lead to unaligned accesses [-Wunaligned-access]
This happens because 'struct efi_hii_keyboard_layout' is defined as
packed while efi_guid_t is 32bit aligned.
However the EFI spec describes the EFI_GUID as
"128-bit buffer containing a unique identifier value.
Unless otherwise specified aligned on a 64-bit boundary"
So convert the efi_guid_t -> u8 b[16] here and skip the alignment
requirements.
Reported-by: Tom Rini <trini at konsulko.com>
Suggested-by: Heinrich Schuchardt <heinrich.schuchardt at canonical.com>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas at linaro.org>
---
include/efi_api.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/efi_api.h b/include/efi_api.h
index 2fd0221c1c77..b84b577bd7b5 100644
--- a/include/efi_api.h
+++ b/include/efi_api.h
@@ -1170,7 +1170,7 @@ struct efi_key_descriptor {
struct efi_hii_keyboard_layout {
u16 layout_length;
- efi_guid_t guid;
+ u8 guid[16];
u32 layout_descriptor_string_offset;
u8 descriptor_count;
/* struct efi_key_descriptor descriptors[]; follows here */
--
2.39.2
More information about the U-Boot
mailing list