public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [PATCH 1/2] efi_loader: Fix flexible array member definitions
@ 2023-04-06 19:37 Ilias Apalodimas
  2023-04-06 19:37 ` [PATCH 2/2] efi_loader: Fix warnings on unaligned accesses Ilias Apalodimas
  0 siblings, 1 reply; 9+ messages in thread
From: Ilias Apalodimas @ 2023-04-06 19:37 UTC (permalink / raw)
  To: u-boot; +Cc: Ilias Apalodimas, Heinrich Schuchardt

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>
---
 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 dc6e5ce236c9..2fd0221c1c77 100644
--- a/include/efi_api.h
+++ b/include/efi_api.h
@@ -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 {
--
2.39.2


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2023-04-20  8:00 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-06 19:37 [PATCH 1/2] efi_loader: Fix flexible array member definitions Ilias Apalodimas
2023-04-06 19:37 ` [PATCH 2/2] efi_loader: Fix warnings on unaligned accesses Ilias Apalodimas
2023-04-07  1:46   ` AKASHI Takahiro
2023-04-07  2:24     ` Tom Rini
2023-04-07  7:33     ` Ilias Apalodimas
2023-04-20  6:35       ` Ilias Apalodimas
2023-04-20  6:36         ` Ilias Apalodimas
2023-04-20  7:16         ` AKASHI Takahiro
2023-04-20  7:59           ` Ilias Apalodimas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox