[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230703123737.3420464-1-arnd@kernel.org>
Date: Mon, 3 Jul 2023 14:37:29 +0200
From: Arnd Bergmann <arnd@...nel.org>
To: Kalle Valo <kvalo@...nel.org>,
Jeff Johnson <quic_jjohnson@...cinc.com>,
Balamurugan Selvarajan <quic_bselvara@...cinc.com>,
P Praneesh <quic_ppranees@...cinc.com>,
Baochen Qiang <quic_bqiang@...cinc.com>,
Karthikeyan Periyasamy <quic_periyasa@...cinc.com>
Cc: Arnd Bergmann <arnd@...db.de>,
Ramya Gnanasekar <quic_rgnanase@...cinc.com>,
Wen Gong <quic_wgong@...cinc.com>,
Karthik M <quic_karm@...cinc.com>,
Aditya Kumar Singh <quic_adisi@...cinc.com>,
Aishwarya R <quic_aisr@...cinc.com>,
Carl Huang <quic_cjhuang@...cinc.com>,
ath12k@...ts.infradead.org, linux-wireless@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH] ath12k: fix memcpy array overflow in ath12k_peer_assoc_h_he
From: Arnd Bergmann <arnd@...db.de>
Two memory copies in this function copy from a short array into a longer one,
using the wrong size, which leads to an out-of-bounds access:
include/linux/fortify-string.h:592:4: error: call to '__read_overflow2_field' declared with 'warning' attribute: detected read beyond size of field (2nd parameter); maybe use struct_group()? [-Werror,-Wattribute-warning]
__read_overflow2_field(q_size_field, size);
^
include/linux/fortify-string.h:592:4: error: call to '__read_overflow2_field' declared with 'warning' attribute: detected read beyond size of field (2nd parameter); maybe use struct_group()? [-Werror,-Wattribute-warning]
2 errors generated.
Fixes: d889913205cf7 ("wifi: ath12k: driver for Qualcomm Wi-Fi 7 devices")
Signed-off-by: Arnd Bergmann <arnd@...db.de>
---
drivers/net/wireless/ath/ath12k/mac.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/wireless/ath/ath12k/mac.c b/drivers/net/wireless/ath/ath12k/mac.c
index f5ebebe806e0d..b8a8d33cc4187 100644
--- a/drivers/net/wireless/ath/ath12k/mac.c
+++ b/drivers/net/wireless/ath/ath12k/mac.c
@@ -1637,9 +1637,9 @@ static void ath12k_peer_assoc_h_he(struct ath12k *ar,
arg->peer_nss = min(sta->deflink.rx_nss, max_nss);
memcpy(&arg->peer_he_cap_macinfo, he_cap->he_cap_elem.mac_cap_info,
- sizeof(arg->peer_he_cap_macinfo));
+ sizeof(he_cap->he_cap_elem.mac_cap_info));
memcpy(&arg->peer_he_cap_phyinfo, he_cap->he_cap_elem.phy_cap_info,
- sizeof(arg->peer_he_cap_phyinfo));
+ sizeof(he_cap->he_cap_elem.phy_cap_info));
arg->peer_he_ops = vif->bss_conf.he_oper.params;
/* the top most byte is used to indicate BSS color info */
--
2.39.2
Powered by blists - more mailing lists