2015-09-22 14:24:38

by Oleksij Rempel

[permalink] [raw]
Subject: [PATCH] ath9k_htc: use ether_addr_copy() instead of memcpy()

Signed-off-by: Oleksij Rempel <[email protected]>
---
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(-)

diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_init.c b/drivers/net/wireless/ath/ath9k/htc_drv_init.c
index 1e84882..254a1e4 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_init.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_init.c
@@ -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;
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_main.c b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
index 172a9ff..e6b13ed 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
@@ -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);
}
}
--
2.5.0



2015-09-23 13:14:47

by Sujith Manoharan

[permalink] [raw]
Subject: Re: [PATCH] ath9k_htc: use ether_addr_copy() instead of memcpy()

Oleksij Rempel wrote:
> Signed-off-by: Oleksij Rempel <[email protected]>
> ---
> 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

2015-09-23 16:43:11

by Oleksij Rempel

[permalink] [raw]
Subject: Re: [PATCH] ath9k_htc: use ether_addr_copy() instead of memcpy()

Am 23.09.2015 um 15:16 schrieb Sujith Manoharan:
> Oleksij Rempel wrote:
>> Signed-off-by: Oleksij Rempel <[email protected]>
>> ---
>> 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
>

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

--
Regards,
Oleksij


Attachments:
signature.asc (213.00 B)
OpenPGP digital signature

2015-09-29 08:22:23

by Kalle Valo

[permalink] [raw]
Subject: Re: [PATCH] ath9k_htc: use ether_addr_copy() instead of memcpy()

Oleksij Rempel <[email protected]> writes:

> Am 23.09.2015 um 15:16 schrieb Sujith Manoharan:
>> Oleksij Rempel wrote:
>>> Signed-off-by: Oleksij Rempel <[email protected]>
>>> ---
>>> 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 ?
>
> hm... you right. Kvalo, please drop this patch.

Dropped.

--
Kalle Valo