Skip to contentSkip to conversation

ath11k: fix mac_cap_info copy size

PATCH Superseded John Crispin 1 participant 2 messages Jun 19, 2019 Qualcomm Atheros ATH11K wireless driver

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ath11k: fix mac_cap_info copy size

The code currently copies the he_cap field when adding a peer from a six byte to an eight byte buffer. Switch from using the dest buffer length to that of the src buffer. Also make sure that the trailing 2 bytes are zero'ed out.

---
 drivers/net/wireless/ath/ath11k/mac.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireless/ath/ath11k/mac.c +2 -1
index 53177a9e3c7e..7239013b59ca 100644
@@ -1262,8 +1262,9 @@ static void ath11k_peer_assoc_h_he(struct ath11k *ar,
 
 	arg->he_flag = true;
 
+	memset(&arg->peer_he_cap_macinfo, 0, sizeof(&arg->peer_he_cap_macinfo));
 	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));
 	memcpy(&arg->peer_he_ops, &vif->bss_conf.he_operation,
Signature · 7 lines
2.20.1


_______________________________________________
ath11k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath11k
#1 lore raw
Quoted 15 lines · John Crispin

The code currently copies the he_cap field when adding a peer from a six byte to an eight byte buffer. Switch from using the dest buffer length to that of the src buffer. Also make sure that the trailing 2 bytes are zero'ed out.

---
  drivers/net/wireless/ath/ath11k/mac.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireless/ath/ath11k/mac.c +0 -0
index 53177a9e3c7e..7239013b59ca 100644

drivers/net/wireless/ath/ath11k/mac.c static void ath11k_peer_assoc_h_he(struct ath11k *ar, · line 1265

Quoted 4 lines
drivers/net/wireless/ath/ath11k/mac.c +1 -0
@@ -1262,8 +1262,9 @@ static void ath11k_peer_assoc_h_he(struct ath11k *ar,
 
  	arg->he_flag = true;
 
+	memset(&arg->peer_he_cap_macinfo, 0, sizeof(&arg->peer_he_cap_macinfo));

stray & ... forgot to commit --amend prior to sending this

    John

drivers/net/wireless/ath/ath11k/mac.c static void ath11k_peer_assoc_h_he(struct ath11k *ar, · line 1270

Quoted 6 lines
drivers/net/wireless/ath/ath11k/mac.c +1 -1
  	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));
  	memcpy(&arg->peer_he_ops, &vif->bss_conf.he_operation,

_______________________________________________
ath11k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath11k