Skip to content

Commit be812ac

Browse files
GustavoARSilvaVudentz
authored andcommitted
Bluetooth: Avoid a couple dozen -Wflex-array-member-not-at-end warnings
-Wflex-array-member-not-at-end was introduced in GCC-14, and we are getting ready to enable it, globally. Use the __struct_group() helper to fix 31 instances of the following type of warnings: 30 net/bluetooth/mgmt_config.c:16:33: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end] 1 net/bluetooth/mgmt_config.c:22:33: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end] Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org> Reviewed-by: Simon Horman <horms@kernel.org> Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
1 parent 03ddb4a commit be812ac

2 files changed

Lines changed: 9 additions & 4 deletions

File tree

include/net/bluetooth/mgmt.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,15 @@ struct mgmt_hdr {
5353
} __packed;
5454

5555
struct mgmt_tlv {
56-
__le16 type;
57-
__u8 length;
56+
/* New members MUST be added within the __struct_group() macro below. */
57+
__struct_group(mgmt_tlv_hdr, __hdr, __packed,
58+
__le16 type;
59+
__u8 length;
60+
);
5861
__u8 value[];
5962
} __packed;
63+
static_assert(offsetof(struct mgmt_tlv, value) == sizeof(struct mgmt_tlv_hdr),
64+
"struct member likely outside of __struct_group()");
6065

6166
struct mgmt_addr_info {
6267
bdaddr_t bdaddr;

net/bluetooth/mgmt_config.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@
1313

1414
#define HDEV_PARAM_U16(_param_name_) \
1515
struct {\
16-
struct mgmt_tlv entry; \
16+
struct mgmt_tlv_hdr entry; \
1717
__le16 value; \
1818
} __packed _param_name_
1919

2020
#define HDEV_PARAM_U8(_param_name_) \
2121
struct {\
22-
struct mgmt_tlv entry; \
22+
struct mgmt_tlv_hdr entry; \
2323
__u8 value; \
2424
} __packed _param_name_
2525

0 commit comments

Comments
 (0)