diff options
author | Elyes Haouas <ehaouas@noos.fr> | 2023-07-28 06:20:48 +0200 |
---|---|---|
committer | Felix Singer <service+coreboot-gerrit@felixsinger.de> | 2023-07-31 04:28:31 +0000 |
commit | 242bac0e162ca9a9258f61b0674b0dced5bcc01a (patch) | |
tree | 06026a25835531ed87820920c452ca9abb8062e9 /src/commonlib | |
parent | bfdb7551b18a8bf5f4c34e055828cd11408c85ae (diff) |
commonlib/bsd/cbfs_serialized.h: Use C99 flexible arrays
Use C99 flexible arrays instead of older style of one-element or
zero-length arrays.
It allows the compiler to generate errors when the flexible array does
not occur at the end in the structure.
Change-Id: I00807a435a21e078c89f797cfd0b00d03604ea0e
Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/76786
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
Reviewed-by: Felix Singer <service+coreboot-gerrit@felixsinger.de>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/commonlib')
-rw-r--r-- | src/commonlib/bsd/include/commonlib/bsd/cbfs_serialized.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/commonlib/bsd/include/commonlib/bsd/cbfs_serialized.h b/src/commonlib/bsd/include/commonlib/bsd/cbfs_serialized.h index 605412bbe1..07d3d9de4d 100644 --- a/src/commonlib/bsd/include/commonlib/bsd/cbfs_serialized.h +++ b/src/commonlib/bsd/include/commonlib/bsd/cbfs_serialized.h @@ -60,7 +60,7 @@ struct cbfs_header { uint32_t align; /* fixed to 64 bytes */ uint32_t offset; uint32_t architecture; - uint32_t pad[1]; + uint32_t pad[]; } __packed; /* this used to be flexible, but wasn't ever set to something different. */ @@ -103,7 +103,7 @@ struct cbfs_file { uint32_t type; uint32_t attributes_offset; uint32_t offset; - char filename[0]; + char filename[]; } __packed; #if defined __GNUC__ && (__GNUC__ * 100 + __GNUC_MINOR__) >= 406 @@ -117,7 +117,7 @@ struct cbfs_file_attribute { uint32_t tag; /* len covers the whole structure, incl. tag and len */ uint32_t len; - uint8_t data[0]; + uint8_t data[]; } __packed; /* All attribute sizes must be divisible by this! */ |