linux/drivers/net/wireless/ath/wil6210
Dmitry Antipov 1ad8237e97 wifi: wil6210: fix fortify warnings
When compiling with gcc 13.1 and CONFIG_FORTIFY_SOURCE=y,
I've noticed the following:

In function ‘fortify_memcpy_chk’,
    inlined from ‘wil_rx_crypto_check_edma’ at drivers/net/wireless/ath/wil6210/txrx_edma.c:566:2:
./include/linux/fortify-string.h:529:25: warning: call to ‘__read_overflow2_field’
declared with attribute warning: detected read beyond size of field (2nd parameter);
maybe use struct_group()? [-Wattribute-warning]
  529 |                         __read_overflow2_field(q_size_field, size);
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

where the compiler complains on:

const u8 *pn;
...
pn = (u8 *)&st->ext.pn_15_0;
...
memcpy(cc->pn, pn, IEEE80211_GCMP_PN_LEN);

and:

In function ‘fortify_memcpy_chk’,
    inlined from ‘wil_rx_crypto_check’ at drivers/net/wireless/ath/wil6210/txrx.c:684:2:
./include/linux/fortify-string.h:529:25: warning: call to ‘__read_overflow2_field’
declared with attribute warning: detected read beyond size of field (2nd parameter);
maybe use struct_group()? [-Wattribute-warning]
  529 |                         __read_overflow2_field(q_size_field, size);
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

where the compiler complains on:

const u8 *pn = (u8 *)&d->mac.pn_15_0;
...
memcpy(cc->pn, pn, IEEE80211_GCMP_PN_LEN);

In both cases, the fortification logic interprets 'memcpy()' as 6-byte
overread of 2-byte field 'pn_15_0' of 'struct wil_rx_status_extension'
and 'pn_15_0' of 'struct vring_rx_mac', respectively. To silence
these warnings, last two fields of the aforementioned structures
are grouped using 'struct_group_attr(pn, __packed' quirk.

Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Link: https://lore.kernel.org/r/20230621093711.80118-1-dmantipov@yandex.ru
2023-07-27 19:12:49 +03:00
..
boot_loader.h
cfg80211.c
debug.c
debugfs.c
ethtool.c
fw.c
fw.h wifi: wil6210: fw: Replace zero-length arrays with DECLARE_FLEX_ARRAY() helper 2023-05-25 20:02:47 +03:00
fw_inc.c
interrupt.c
Kconfig
main.c
Makefile
netdev.c net: drop the weight argument from netif_napi_add 2022-09-28 18:57:14 -07:00
p2p.c
pcie_bus.c
pm.c
pmc.c
pmc.h
rx_reorder.c
trace.c
trace.h
txrx.c wifi: wil6210: fix fortify warnings 2023-07-27 19:12:49 +03:00
txrx.h wifi: wil6210: fix fortify warnings 2023-07-27 19:12:49 +03:00
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
wil6210.h
wil_crash_dump.c
wil_platform.c
wil_platform.h
wmi.c
wmi.h wifi: wil6210: wmi: Replace zero-length array with DECLARE_FLEX_ARRAY() helper 2023-05-25 20:03:35 +03:00