public inbox for ath12k@lists.infradead.org
 help / color / mirror / Atom feed
* Re: ath12k: memcpy() source buffer overread
       [not found] <5c114ed7-6e8a-76a7-c0da-4193d1288686@yandex.ru>
@ 2023-08-03 13:54 ` Kalle Valo
  0 siblings, 0 replies; only message in thread
From: Kalle Valo @ 2023-08-03 13:54 UTC (permalink / raw)
  To: Dmitry Antipov; +Cc: linux-wireless, ath12k

+ ath12k list

Dmitry Antipov <dmantipov@yandex.ru> writes:

> When compiling with gcc 13.1 and CONFIG_FORTIFY_SOURCE=y, I've noticed the following:
>
> ...
> In function ‘fortify_memcpy_chk’,
>     inlined from ‘ath12k_peer_assoc_h_he’ at drivers/net/wireless/ath/ath12k/mac.c:1640:2,
>     inlined from ‘ath12k_peer_assoc_prepare’ at drivers/net/wireless/ath/ath12k/mac.c:2027: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);
>       |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> In function ‘fortify_memcpy_chk’,
>     inlined from ‘ath12k_peer_assoc_h_he’ at drivers/net/wireless/ath/ath12k/mac.c:1643:2,
>     inlined from ‘ath12k_peer_assoc_prepare’ at drivers/net/wireless/ath/ath12k/mac.c:2027: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);
>       |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> ...
>
> And this seems correct because:
>
> /* dst: u32[2], src: u8[6], size: 8 so 2 byte source overread */
> memcpy(&arg->peer_he_cap_macinfo, he_cap->he_cap_elem.mac_cap_info,
>        sizeof(arg->peer_he_cap_macinfo));
>
> and:
>
> /* dst: u32[3], src: u8[11], size: 12 so 1 byte source overread */
> memcpy(&arg->peer_he_cap_phyinfo, he_cap->he_cap_elem.phy_cap_info,
>        sizeof(arg->peer_he_cap_phyinfo));

Arnd fixed this:

https://git.kernel.org/kvalo/ath/c/603cf6c2fcdc

-- 
https://patchwork.kernel.org/project/linux-wireless/list/

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

-- 
ath12k mailing list
ath12k@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/ath12k

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-08-03 13:54 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <5c114ed7-6e8a-76a7-c0da-4193d1288686@yandex.ru>
2023-08-03 13:54 ` ath12k: memcpy() source buffer overread Kalle Valo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox