Skip to content

Commit cd8da63

Browse files
GustavoARSilvakees
authored andcommitted
carl9170: Avoid -Wflex-array-member-not-at-end warning
-Wflex-array-member-not-at-end was introduced in GCC-14, and we are getting ready to enable it, globally. Move the conflicting declaration (which happens to be in a union, so we're moving the entire union) to the end of the corresponding structure. Notice that `struct carl9170_rsp` is a flexible structure, this is a structure that contains a flexible-array member. With these changes fix the following warning: drivers/net/wireless/ath/carl9170/carl9170.h:382:9: 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> Acked-by: Christian Lamparter <chunkeey@gmail.com> Link: https://patch.msgid.link/aR1yxjmzb2DM2-Uq@kspp Signed-off-by: Kees Cook <kees@kernel.org>
1 parent fac4ab5 commit cd8da63

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

drivers/net/wireless/ath/carl9170/carl9170.h

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -375,11 +375,6 @@ struct ar9170 {
375375
u8 *readbuf;
376376
spinlock_t cmd_lock;
377377
struct completion cmd_wait;
378-
union {
379-
__le32 cmd_buf[PAYLOAD_MAX + 1];
380-
struct carl9170_cmd cmd;
381-
struct carl9170_rsp rsp;
382-
};
383378

384379
/* statistics */
385380
unsigned int tx_dropped;
@@ -463,6 +458,13 @@ struct ar9170 {
463458
unsigned int cache_idx;
464459
} rng;
465460
#endif /* CONFIG_CARL9170_HWRNG */
461+
462+
/* Must be last as it ends in a flexible-array member. */
463+
union {
464+
__le32 cmd_buf[PAYLOAD_MAX + 1];
465+
struct carl9170_cmd cmd;
466+
struct carl9170_rsp rsp;
467+
};
466468
};
467469

468470
enum carl9170_ps_off_override_reasons {

0 commit comments

Comments
 (0)