bianbu-linux-6.6/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 wifi: cfg80211: Add link_id parameter to various key operations for MLO 2022-08-25 10:41:05 +02:00
debug.c
debugfs.c wifi: wil6210: debugfs: use DEFINE_SHOW_ATTRIBUTE to simplify fw_capabilities/fw_version 2022-09-28 10:45:20 +03:00
ethtool.c ethtool: extend coalesce setting uAPI with CQE mode 2021-08-24 07:38:29 -07:00
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 wil6210: Fix wrong function name in comments 2021-06-15 17:01:25 +03:00
Kconfig wil6210: select CONFIG_CRC32 2021-01-05 15:50:36 -08:00
main.c wifi: move from strlcpy with unused retval to strscpy 2022-09-02 11:47:22 +03:00
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 cfg80211: avoid holding the RTNL when calling the driver 2021-01-26 11:55:50 +01:00
pm.c wil6210: use pm_runtime_resume_and_get() instead of pm_runtime_get_sync() 2022-04-23 12:31:48 +03:00
pmc.c wil6210: pmc: Demote a few nonconformant kernel-doc function headers 2020-08-31 18:18:40 +03:00
pmc.h
rx_reorder.c
trace.c
trace.h tracing/ath: Use the new __vstring() helper 2022-07-15 17:44:40 -04:00
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 wil6210: use NAPI_POLL_WEIGHT for napi budget 2022-05-02 17:00:11 +03:00
wil_crash_dump.c
wil_platform.c wil6210: wil_platform: Demote kernel-doc header to standard comment block 2020-08-31 18:18:43 +03:00
wil_platform.h
wmi.c wifi: move from strlcpy with unused retval to strscpy 2022-09-02 11:47:22 +03:00
wmi.h wifi: wil6210: wmi: Replace zero-length array with DECLARE_FLEX_ARRAY() helper 2023-05-25 20:03:35 +03:00