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>
This commit is contained in:
Filip Lewiński
2026-05-15 13:03:00 +02:00
parent bf1e9bb4b5
commit 467162060e
+11
View File
@@ -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 */