Skip to contentSkip to conversation

ath9k_htc: use ether_addr_copy() instead of memcpy()

PATCH In review Oleksij Rempel 3 participants 4 messages Sep 22, 2015 – Sep 29, 2015 1 message not in the archive Qualcomm Atheros ATH9K wireless driver

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 1/1 ath9k_htc: use ether_addr_copy() instead of memcpy()

---
 drivers/net/wireless/ath/ath9k/htc_drv_init.c |  2 +-
 drivers/net/wireless/ath/ath9k/htc_drv_main.c | 24 ++++++++++++------------
 2 files changed, 13 insertions(+), 13 deletions(-)
drivers/net/wireless/ath/ath9k/htc_drv_init.c +1 -1
index 1e84882..254a1e4 100644
@@ -587,7 +587,7 @@ static void ath9k_init_misc(struct ath9k_htc_priv *priv)
 {
 	struct ath_common *common = ath9k_hw_common(priv->ah);
 
-	memcpy(common->bssidmask, ath_bcast_mac, ETH_ALEN);
+	ether_addr_copy(common->bssidmask, ath_bcast_mac);
 
 	common->last_rssi = ATH_RSSI_DUMMY_MARKER;
 	priv->ah->opmode = NL80211_IFTYPE_STATION;
drivers/net/wireless/ath/ath9k/htc_drv_main.c +12 -12
index 172a9ff..e6b13ed 100644
@@ -159,10 +159,10 @@ static void ath9k_htc_set_mac_bssid_mask(struct ath9k_htc_priv *priv,
 		priv->hw, IEEE80211_IFACE_ITER_RESUME_ALL,
 		ath9k_htc_bssid_iter, &iter_data);
 
-	memcpy(common->bssidmask, iter_data.mask, ETH_ALEN);
+	ether_addr_copy(common->bssidmask, iter_data.mask);
 
 	if (iter_data.hw_macaddr)
-		memcpy(common->macaddr, iter_data.hw_macaddr, ETH_ALEN);
+		ether_addr_copy(common->macaddr, iter_data.hw_macaddr);
 
 	ath_hw_setbssidmask(common);
 }
@@ -338,7 +338,7 @@ static void __ath9k_htc_remove_monitor_interface(struct ath9k_htc_priv *priv)
 	u8 cmd_rsp;
 
 	memset(&hvif, 0, sizeof(struct ath9k_htc_target_vif));
-	memcpy(&hvif.myaddr, common->macaddr, ETH_ALEN);
+	ether_addr_copy(hvif.myaddr, common->macaddr);
 	hvif.index = priv->mon_vif_idx;
 	WMI_CMD_BUF(WMI_VAP_REMOVE_CMDID, &hvif);
 	if (ret) {
@@ -374,7 +374,7 @@ static int ath9k_htc_add_monitor_interface(struct ath9k_htc_priv *priv)
 	 * Add an interface.
 	 */
 	memset(&hvif, 0, sizeof(struct ath9k_htc_target_vif));
-	memcpy(&hvif.myaddr, common->macaddr, ETH_ALEN);
+	ether_addr_copy(hvif.myaddr, common->macaddr);
 
 	hvif.opmode = HTC_M_MONITOR;
 	hvif.index = ffz(priv->vif_slot);
@@ -404,7 +404,7 @@ static int ath9k_htc_add_monitor_interface(struct ath9k_htc_priv *priv)
 	 */
 	memset(&tsta, 0, sizeof(struct ath9k_htc_target_sta));
 
-	memcpy(&tsta.macaddr, common->macaddr, ETH_ALEN);
+	ether_addr_copy(tsta.macaddr, common->macaddr);
 
 	tsta.is_vif_sta = 1;
 	tsta.sta_index = sta_idx;
@@ -489,15 +489,15 @@ static int ath9k_htc_add_station(struct ath9k_htc_priv *priv,
 
 	if (sta) {
 		ista = (struct ath9k_htc_sta *) sta->drv_priv;
-		memcpy(&tsta.macaddr, sta->addr, ETH_ALEN);
-		memcpy(&tsta.bssid, common->curbssid, ETH_ALEN);
+		ether_addr_copy(tsta.macaddr, sta->addr);
+		ether_addr_copy(tsta.bssid, common->curbssid);
 		ista->index = sta_idx;
 		tsta.is_vif_sta = 0;
 		maxampdu = 1 << (IEEE80211_HT_MAX_AMPDU_FACTOR +
 				 sta->ht_cap.ampdu_factor);
 		tsta.maxampdu = cpu_to_be16(maxampdu);
 	} else {
-		memcpy(&tsta.macaddr, vif->addr, ETH_ALEN);
+		ether_addr_copy(tsta.macaddr, vif->addr);
 		tsta.is_vif_sta = 1;
 		tsta.maxampdu = cpu_to_be16(0xffff);
 	}
@@ -1048,7 +1048,7 @@ static int ath9k_htc_add_interface(struct ieee80211_hw *hw,
 
 	ath9k_htc_ps_wakeup(priv);
 	memset(&hvif, 0, sizeof(struct ath9k_htc_target_vif));
-	memcpy(&hvif.myaddr, vif->addr, ETH_ALEN);
+	ether_addr_copy(hvif.myaddr, vif->addr);
 
 	switch (vif->type) {
 	case NL80211_IFTYPE_STATION:
@@ -1131,7 +1131,7 @@ static void ath9k_htc_remove_interface(struct ieee80211_hw *hw,
 	ath9k_htc_ps_wakeup(priv);
 
 	memset(&hvif, 0, sizeof(struct ath9k_htc_target_vif));
-	memcpy(&hvif.myaddr, vif->addr, ETH_ALEN);
+	ether_addr_copy(hvif.myaddr, vif->addr);
 	hvif.index = avp->index;
 	WMI_CMD_BUF(WMI_VAP_REMOVE_CMDID, &hvif);
 	if (ret) {
@@ -1493,7 +1493,7 @@ static void ath9k_htc_bss_iter(void *data, u8 *mac, struct ieee80211_vif *vif)
 	if ((vif->type == NL80211_IFTYPE_STATION) && bss_conf->assoc) {
 		common->curaid = bss_conf->aid;
 		common->last_rssi = ATH_RSSI_DUMMY_MARKER;
-		memcpy(common->curbssid, bss_conf->bssid, ETH_ALEN);
+		ether_addr_copy(common->curbssid, bss_conf->bssid);
 		set_bit(ATH_OP_PRIM_STA_VIF, &common->op_flags);
 	}
 }
@@ -1543,7 +1543,7 @@ static void ath9k_htc_bss_info_changed(struct ieee80211_hw *hw,
 	if (changed & BSS_CHANGED_IBSS) {
 		if (priv->ah->opmode == NL80211_IFTYPE_ADHOC) {
 			common->curaid = bss_conf->aid;
-			memcpy(common->curbssid, bss_conf->bssid, ETH_ALEN);
+			ether_addr_copy(common->curbssid, bss_conf->bssid);
 			ath9k_htc_set_bssid(priv);
 		}
 	}
Signature · 1 line
2.5.0
#2 lore raw
Quoted 5 lines · Oleksij Rempel
---
 drivers/net/wireless/ath/ath9k/htc_drv_init.c |  2 +-
 drivers/net/wireless/ath/ath9k/htc_drv_main.c | 24 ++++++++++++------------
 2 files changed, 13 insertions(+), 13 deletions(-)

Both the arguments for ether_addr_copy() need to be aligned. Is this the case for all the replacements in this patch ?

Sujith

#3 lore raw

Am 23.09.2015 um 15:16 schrieb Sujith Manoharan:

Quoted 7 lines
Quoted 5 lines · Oleksij Rempel
---
 drivers/net/wireless/ath/ath9k/htc_drv_init.c |  2 +-
 drivers/net/wireless/ath/ath9k/htc_drv_main.c | 24 ++++++++++++------------
 2 files changed, 13 insertions(+), 13 deletions(-)
Quoted 6 lines

Both the arguments for ether_addr_copy() need to be aligned. Is this the case for all the replacements in this patch ?

Sujith

hm... you right. Kvalo, please drop this patch.

Signature · 2 lines
Regards,
Oleksij
#4 lore raw
Quoted 8 lines · Oleksij Rempel

Am 23.09.2015 um 15:16 schrieb Sujith Manoharan:

Quoted 7 lines
Quoted 5 lines · Oleksij Rempel
---
 drivers/net/wireless/ath/ath9k/htc_drv_init.c |  2 +-
 drivers/net/wireless/ath/ath9k/htc_drv_main.c | 24 ++++++++++++------------
 2 files changed, 13 insertions(+), 13 deletions(-)
Quoted 5 lines
Quoted 3 lines

Both the arguments for ether_addr_copy() need to be aligned. Is this the case for all the replacements in this patch ?

hm... you right. Kvalo, please drop this patch.

Dropped.

Signature · 1 line
Kalle Valo