linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] wifi: ath12k: fix one more memcpy size error
@ 2024-10-04  9:54 Arnd Bergmann
  2024-10-07 11:20 ` Kalle Valo
  2024-10-07 21:43 ` Jeff Johnson
  0 siblings, 2 replies; 3+ messages in thread
From: Arnd Bergmann @ 2024-10-04  9:54 UTC (permalink / raw)
  To: Kalle Valo, Jeff Johnson, Jakub Kicinski, Kees Cook, Paolo Abeni,
	Baochen Qiang
  Cc: Arnd Bergmann, Rameshkumar Sundaram, linux-wireless, ath12k,
	linux-kernel

From: Arnd Bergmann <arnd@arndb.de>

A previous patch addressed a fortified-memcpy warning on older compilers,
but there is still a warning on gcc-14 in some configurations:

In file included from include/linux/string.h:390,
                 from drivers/net/wireless/ath/ath12k/wow.c:7:
drivers/net/wireless/ath/ath12k/wow.c: In function 'ath12k_wow_convert_8023_to_80211.isra':
include/linux/fortify-string.h:114:33: error: '__builtin_memcpy' accessing 18446744073709551610 or more bytes at offsets 0 and 0 overlaps 9223372036854775797 bytes at offset -9223372036854775803 [-Werror=restrict]
include/linux/fortify-string.h:679:26: note: in expansion of macro '__fortify_memcpy_chk'
  679 | #define memcpy(p, q, s)  __fortify_memcpy_chk(p, q, s,                  \
      |                          ^~~~~~~~~~~~~~~~~~~~
drivers/net/wireless/ath/ath12k/wow.c:199:25: note: in expansion of macro 'memcpy'
  199 |                         memcpy(pat + a3_ofs - pkt_ofs,
      |                         ^~~~~~

Address this the same way as the other two, using size_add().

Fixes: b49991d83bba ("wifi: ath12k: fix build vs old compiler")
Fixes: 4a3c212eee0e ("wifi: ath12k: add basic WoW functionalities")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/net/wireless/ath/ath12k/wow.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath12k/wow.c b/drivers/net/wireless/ath/ath12k/wow.c
index 9b8684abbe40..3624180b25b9 100644
--- a/drivers/net/wireless/ath/ath12k/wow.c
+++ b/drivers/net/wireless/ath/ath12k/wow.c
@@ -191,7 +191,7 @@ ath12k_wow_convert_8023_to_80211(struct ath12k *ar,
 			memcpy(bytemask, eth_bytemask, eth_pat_len);
 
 			pat_len = eth_pat_len;
-		} else if (eth_pkt_ofs + eth_pat_len < prot_ofs) {
+		} else if (size_add(eth_pkt_ofs, eth_pat_len) < prot_ofs) {
 			memcpy(pat, eth_pat, ETH_ALEN - eth_pkt_ofs);
 			memcpy(bytemask, eth_bytemask, ETH_ALEN - eth_pkt_ofs);
 
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] wifi: ath12k: fix one more memcpy size error
  2024-10-04  9:54 [PATCH] wifi: ath12k: fix one more memcpy size error Arnd Bergmann
@ 2024-10-07 11:20 ` Kalle Valo
  2024-10-07 21:43 ` Jeff Johnson
  1 sibling, 0 replies; 3+ messages in thread
From: Kalle Valo @ 2024-10-07 11:20 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Jeff Johnson, Jakub Kicinski, Kees Cook, Paolo Abeni,
	Baochen Qiang, Arnd Bergmann, Rameshkumar Sundaram,
	linux-wireless, ath12k, linux-kernel

Arnd Bergmann <arnd@kernel.org> writes:

> From: Arnd Bergmann <arnd@arndb.de>
>
> A previous patch addressed a fortified-memcpy warning on older compilers,
> but there is still a warning on gcc-14 in some configurations:
>
> In file included from include/linux/string.h:390,
>                  from drivers/net/wireless/ath/ath12k/wow.c:7:
> drivers/net/wireless/ath/ath12k/wow.c: In function 'ath12k_wow_convert_8023_to_80211.isra':
> include/linux/fortify-string.h:114:33: error: '__builtin_memcpy' accessing 18446744073709551610 or more bytes at offsets 0 and 0 overlaps 9223372036854775797 bytes at offset -9223372036854775803 [-Werror=restrict]
> include/linux/fortify-string.h:679:26: note: in expansion of macro '__fortify_memcpy_chk'
>   679 | #define memcpy(p, q, s)  __fortify_memcpy_chk(p, q, s,                  \
>       |                          ^~~~~~~~~~~~~~~~~~~~
> drivers/net/wireless/ath/ath12k/wow.c:199:25: note: in expansion of macro 'memcpy'
>   199 |                         memcpy(pat + a3_ofs - pkt_ofs,
>       |                         ^~~~~~
>
> Address this the same way as the other two, using size_add().
>
> Fixes: b49991d83bba ("wifi: ath12k: fix build vs old compiler")
> Fixes: 4a3c212eee0e ("wifi: ath12k: add basic WoW functionalities")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Acked-by: Kalle Valo <kvalo@kernel.org>

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

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] wifi: ath12k: fix one more memcpy size error
  2024-10-04  9:54 [PATCH] wifi: ath12k: fix one more memcpy size error Arnd Bergmann
  2024-10-07 11:20 ` Kalle Valo
@ 2024-10-07 21:43 ` Jeff Johnson
  1 sibling, 0 replies; 3+ messages in thread
From: Jeff Johnson @ 2024-10-07 21:43 UTC (permalink / raw)
  To: Kalle Valo, Jeff Johnson, Jakub Kicinski, Kees Cook, Paolo Abeni,
	Baochen Qiang, Arnd Bergmann
  Cc: Arnd Bergmann, Rameshkumar Sundaram, linux-wireless, ath12k,
	linux-kernel


On Fri, 04 Oct 2024 09:54:13 +0000, Arnd Bergmann wrote:
> A previous patch addressed a fortified-memcpy warning on older compilers,
> but there is still a warning on gcc-14 in some configurations:
> 
> In file included from include/linux/string.h:390,
>                  from drivers/net/wireless/ath/ath12k/wow.c:7:
> drivers/net/wireless/ath/ath12k/wow.c: In function 'ath12k_wow_convert_8023_to_80211.isra':
> include/linux/fortify-string.h:114:33: error: '__builtin_memcpy' accessing 18446744073709551610 or more bytes at offsets 0 and 0 overlaps 9223372036854775797 bytes at offset -9223372036854775803 [-Werror=restrict]
> include/linux/fortify-string.h:679:26: note: in expansion of macro '__fortify_memcpy_chk'
>   679 | #define memcpy(p, q, s)  __fortify_memcpy_chk(p, q, s,                  \
>       |                          ^~~~~~~~~~~~~~~~~~~~
> drivers/net/wireless/ath/ath12k/wow.c:199:25: note: in expansion of macro 'memcpy'
>   199 |                         memcpy(pat + a3_ofs - pkt_ofs,
>       |                         ^~~~~~
> 
> [...]

Applied, thanks!

[1/1] wifi: ath12k: fix one more memcpy size error
      commit: 19c23eb61fa4c802e6e0aaf74d6f7dcbe99f0ba3

Best regards,
-- 
Jeff Johnson <quic_jjohnson@quicinc.com>


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-10-07 21:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-04  9:54 [PATCH] wifi: ath12k: fix one more memcpy size error Arnd Bergmann
2024-10-07 11:20 ` Kalle Valo
2024-10-07 21:43 ` Jeff Johnson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).