From 242bac0e162ca9a9258f61b0674b0dced5bcc01a Mon Sep 17 00:00:00 2001 From: Elyes Haouas Date: Fri, 28 Jul 2023 06:20:48 +0200 Subject: [PATCH] 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 Reviewed-on: https://review.coreboot.org/c/coreboot/+/76786 Reviewed-by: Arthur Heymans Reviewed-by: Felix Singer Tested-by: build bot (Jenkins) --- src/commonlib/bsd/include/commonlib/bsd/cbfs_serialized.h | 6 +++--- 1 file 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! */