Skip to content
Commit 7dfab398 authored by Ilias Apalodimas's avatar Ilias Apalodimas Committed by Heinrich Schuchardt
Browse files

efi_loader: Fix warnings for unaligned accesses



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 and thus has 1-byte alignment but efi_guid_t is a type that
requires greater alignment than that.

However the EFI spec describes the EFI_GUID as
"128-bit buffer containing a unique identifier value.
Unless otherwise specified"

So convert the efi_guid_t -> u8 b[16] here and skip the alignment
requirements.  Since the struct is packed to begin with, it makes no
difference on the final memory layout.

Suggested-by: default avatarHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reported-by: default avatarTom Rini <trini@konsulko.com>
Signed-off-by: default avatarIlias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: default avatarHeinrich Schuchardt <xypron.glpk@gmx.de>
parent 227d3b3e
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment