mirror of
https://github.com/torvalds/linux.git
synced 2025-11-07 03:59:22 +02:00
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
|
||
|---|---|---|
| .. | ||
| boot_loader.h | ||
| cfg80211.c | ||
| debug.c | ||
| debugfs.c | ||
| ethtool.c | ||
| fw.c | ||
| fw.h | ||
| fw_inc.c | ||
| interrupt.c | ||
| Kconfig | ||
| main.c | ||
| Makefile | ||
| netdev.c | ||
| p2p.c | ||
| pcie_bus.c | ||
| pm.c | ||
| pmc.c | ||
| pmc.h | ||
| rx_reorder.c | ||
| trace.c | ||
| trace.h | ||
| txrx.c | ||
| txrx.h | ||
| txrx_edma.c | ||
| txrx_edma.h | ||
| wil6210.h | ||
| wil_crash_dump.c | ||
| wil_platform.c | ||
| wil_platform.h | ||
| wmi.c | ||
| wmi.h | ||