Skip to content

Commit 68fe887

Browse files
committed
security/intel/cbnt/measurement: fix GCC 13 flex-array build failure
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 <filip.lewinski@3mdeb.com>
1 parent 80d5d6c commit 68fe887

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

src/security/intel/cbnt/measurement.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,15 @@ struct bpm_hash_list {
8686
struct hash_struct hashes[];
8787
} __packed;
8888

89+
/*
90+
* GCC 13+ rejects flex-array members that are not at the end of a containing
91+
* struct. The hash_struct fields below are deprecated since CBnT BWG v1.2.0
92+
* and are always written with size=0 (no data bytes), but their position is
93+
* fixed by the hardware spec, so we suppress the diagnostic here.
94+
*/
95+
#pragma GCC diagnostic push
96+
#pragma GCC diagnostic ignored "-Wflex-array-member-not-at-end"
97+
8998
/* IBB Segment Element (upper part) */
9099
struct bpm_ibbs {
91100
char structure_id[8]; /* "__IBBS__" */
@@ -117,6 +126,8 @@ struct bpm_ibbs_bottom {
117126
/* ibb_segments[segment_count]; */
118127
} __packed;
119128

129+
#pragma GCC diagnostic pop
130+
120131
/* KMHASH_STRUCT */
121132
struct km_hash {
122133
uint64_t usage; /* see KM_HASH_USAGE_* constants for values */

0 commit comments

Comments
 (0)