linux-yocto/drivers/net/wireless/ath/wil6210
Gustavo A. R. Silva 57be3d3562 wifi: radiotap: Avoid -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.

So, in order to avoid ending up with a flexible-array member in the
middle of multiple other structs, we use the `__struct_group()`
helper to create a new tagged `struct ieee80211_radiotap_header_fixed`.
This structure groups together all the members of the flexible
`struct ieee80211_radiotap_header` except the flexible array.

As a result, the array is effectively separated from the rest of the
members without modifying the memory layout of the flexible structure.
We then change the type of the middle struct members currently causing
trouble from `struct ieee80211_radiotap_header` to `struct
ieee80211_radiotap_header_fixed`.

We also want to ensure that in case new members need to be added to the
flexible structure, they are always included within the newly created
tagged struct. For this, we use `static_assert()`. This ensures that the
memory layout for both the flexible structure and the new tagged struct
is the same after any changes.

This approach avoids having to implement `struct ieee80211_radiotap_header_fixed`
as a completely separate structure, thus preventing having to maintain
two independent but basically identical structures, closing the door
to potential bugs in the future.

So, with these changes, fix the following warnings:
drivers/net/wireless/ath/wil6210/txrx.c:309:50: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
drivers/net/wireless/intel/ipw2x00/ipw2100.c:2521:50: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
drivers/net/wireless/intel/ipw2x00/ipw2200.h:1146:42: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
drivers/net/wireless/intel/ipw2x00/libipw.h:595:36: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
drivers/net/wireless/marvell/libertas/radiotap.h:34:42: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
drivers/net/wireless/marvell/libertas/radiotap.h:5:42: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
drivers/net/wireless/microchip/wilc1000/mon.c:10:42: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
drivers/net/wireless/microchip/wilc1000/mon.c:15:42: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
drivers/net/wireless/virtual/mac80211_hwsim.c:758:42: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
drivers/net/wireless/virtual/mac80211_hwsim.c:767:42: 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>
Link: https://patch.msgid.link/ZwBMtBZKcrzwU7l4@kspp
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2024-10-08 21:24:20 +02:00
..
boot_loader.h
cfg80211.c wifi: wil6210: cfg80211: Use __counted_by() in struct wmi_start_scan_cmd and avoid some -Wfamnae warnings 2024-04-04 13:11:27 +03:00
debug.c
debugfs.c
ethtool.c
fw_inc.c wifi: wil6210: fix sparse warnings 2024-03-25 12:50:42 +02:00
fw.c
fw.h wifi: wil6210: fix sparse warnings 2024-03-25 12:50:42 +02:00
interrupt.c
Kconfig
main.c
Makefile
netdev.c wifi: wil6210: Do not use embedded netdev in wil6210_priv 2024-05-07 13:05:24 +03:00
p2p.c
pcie_bus.c
pm.c
pmc.c
pmc.h
rx_reorder.c
trace.c
trace.h
txrx_edma.c wifi: wil6210: fix fortify warnings 2023-07-27 19:12:49 +03:00
txrx_edma.h wifi: wil6210: fix fortify warnings 2023-07-27 19:12:49 +03:00
txrx.c wifi: radiotap: Avoid -Wflex-array-member-not-at-end warnings 2024-10-08 21:24:20 +02:00
txrx.h wifi: wil6210: fix fortify warnings 2023-07-27 19:12:49 +03:00
wil_crash_dump.c
wil_platform.c
wil_platform.h
wil6210.h wifi: wil6210: Do not use embedded netdev in wil6210_priv 2024-05-07 13:05:24 +03:00
wmi.c wifi: wil6210: wmi: Use __counted_by() in struct wmi_set_link_monitor_cmd and avoid -Wfamnae warning 2024-04-04 13:12:20 +03:00
wmi.h wifi: wil6210: wmi: Use __counted_by() in struct wmi_set_link_monitor_cmd and avoid -Wfamnae warning 2024-04-04 13:12:20 +03:00