]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
efi_loader: Fix flexible array member definitions
authorIlias Apalodimas <ilias.apalodimas@linaro.org>
Thu, 6 Apr 2023 19:37:06 +0000 (22:37 +0300)
committerHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
Fri, 21 Apr 2023 06:50:35 +0000 (08:50 +0200)
When a structure contains a flexible array member, it is not supposed to be
included in arrays or other structs.
Quoting the C spec [0]
"Such a structure (and any union containing, possibly recursively, a
member that is such a structure) shall not be a member of a structure
or an element of an array."

IOW efi_hii_keyboard_layout should not include
struct efi_key_descriptor descriptors[]; since we use it at the
declaration of struct efi_hii_keyboard_package.

[0] https://www.dii.uchile.cl/~daespino/files/Iso_C_1999_definition.pdf
chapter 6.7.2.1

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
include/efi_api.h

index dc6e5ce236c9be216ea2408094632ba3a5d9702d..2fd0221c1c77b8da58d8e49cbee6888af215bf32 100644 (file)
@@ -1173,7 +1173,7 @@ struct efi_hii_keyboard_layout {
        efi_guid_t guid;
        u32 layout_descriptor_string_offset;
        u8 descriptor_count;
-       struct efi_key_descriptor descriptors[];
+       /* struct efi_key_descriptor descriptors[]; follows here */
 } __packed;
 
 struct efi_hii_keyboard_package {