From 467162060e14ac00a6e1ea71bbc3f77db2f70a01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filip=20Lewi=C5=84ski?= Date: Fri, 15 May 2026 13:03:00 +0200 Subject: [PATCH] security/intel/cbnt/measurement: fix GCC 13 flex-array build failure MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit GCC 13 promotes -Wflex-array-member-not-at-end to an error. The bpm_ibbs and bpm_ibbs_bottom structs contain hash_struct members with flexible arrays that are not at the end of their containing struct. Their layout is fixed by the CBnT hardware specification and cannot be reordered. Suppress the diagnostic with a pragma guard around the affected struct definitions. These hash_struct fields are deprecated since CBnT BWG v1.2.0 and are always written with size=0 (no payload bytes). Upstream-Status: Pending Signed-off-by: Filip LewiƄski --- src/security/intel/cbnt/measurement.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/security/intel/cbnt/measurement.c b/src/security/intel/cbnt/measurement.c index ba7203df80..bb1fcccbec 100644 --- a/src/security/intel/cbnt/measurement.c +++ b/src/security/intel/cbnt/measurement.c @@ -86,6 +86,15 @@ struct bpm_hash_list { struct hash_struct hashes[]; } __packed; +/* + * GCC 13+ rejects flex-array members that are not at the end of a containing + * struct. The hash_struct fields below are deprecated since CBnT BWG v1.2.0 + * and are always written with size=0 (no data bytes), but their position is + * fixed by the hardware spec, so we suppress the diagnostic here. + */ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wflex-array-member-not-at-end" + /* IBB Segment Element (upper part) */ struct bpm_ibbs { char structure_id[8]; /* "__IBBS__" */ @@ -117,6 +126,8 @@ struct bpm_ibbs_bottom { /* ibb_segments[segment_count]; */ } __packed; +#pragma GCC diagnostic pop + /* KMHASH_STRUCT */ struct km_hash { uint64_t usage; /* see KM_HASH_USAGE_* constants for values */