Search Linux Wireless

Re: [PATCH] wifi: wil6210: fix fortify warnings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Dmitry Antipov <dmantipov@xxxxxxxxx> wrote:

> 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@xxxxxxxxx>
> Signed-off-by: Kalle Valo <quic_kvalo@xxxxxxxxxxx>

Patch applied to ath-next branch of ath.git, thanks.

1ad8237e9716 wifi: wil6210: fix fortify warnings

-- 
https://patchwork.kernel.org/project/linux-wireless/patch/20230621093711.80118-1-dmantipov@xxxxxxxxx/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches




[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Wireless Regulations]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux