[OPW,kernel] staging: rtl8188eu: core: Replaced memcpy() by ether_addr_copy()
diff mbox

Message ID 1414611520-13303-1-git-send-email-gulsah.1004@gmail.com
State New, archived
Headers show

Commit Message

Gulsah Kose Oct. 29, 2014, 7:38 p.m. UTC
This patch fixes

WARNING: Prefer ether_addr_copy() over memcpy() if the Ethernet
addresses are __aligned(2)

checkpatch.pl warning in rtw_sta_mgt.c by using this coccinelle script

@r@
expression e1, e2;
@@

- memcpy(e1, e2, ETH_ALEN);
+ ether_addr_copy(e1, e2);

Signed-off-by: Gulsah Kose <gulsah.1004@gmail.com>
---
 drivers/staging/rtl8188eu/core/rtw_sta_mgt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Julia Lawall Oct. 29, 2014, 7:44 p.m. UTC | #1
On Wed, 29 Oct 2014, Gulsah Kose wrote:

> This patch fixes
> 
> WARNING: Prefer ether_addr_copy() over memcpy() if the Ethernet
> addresses are __aligned(2)
> 
> checkpatch.pl warning in rtw_sta_mgt.c by using this coccinelle script
> 
> @r@
> expression e1, e2;
> @@
> 
> - memcpy(e1, e2, ETH_ALEN);
> + ether_addr_copy(e1, e2);

You need to argue for why the affected location is aligned.

julia

> Signed-off-by: Gulsah Kose <gulsah.1004@gmail.com>
> ---
>  drivers/staging/rtl8188eu/core/rtw_sta_mgt.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c b/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c
> index e1dc8fa..e61f57c 100644
> --- a/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c
> +++ b/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c
> @@ -231,7 +231,7 @@ struct	sta_info *rtw_alloc_stainfo(struct sta_priv *pstapriv, u8 *hwaddr)
>  		list_del_init(&(psta->list));
>  		spin_unlock_bh(&pfree_sta_queue->lock);
>  		_rtw_init_stainfo(psta);
> -		memcpy(psta->hwaddr, hwaddr, ETH_ALEN);
> +		ether_addr_copy(psta->hwaddr, hwaddr);
>  		index = wifi_mac_hash(hwaddr);
>  		RT_TRACE(_module_rtl871x_sta_mgt_c_, _drv_info_, ("rtw_alloc_stainfo: index=%x", index));
>  		if (index >= NUM_STA) {
> -- 
> 1.9.1
> 
> -- 
> You received this message because you are subscribed to the Google Groups "opw-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to opw-kernel+unsubscribe@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

Patch
diff mbox

diff --git a/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c b/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c
index e1dc8fa..e61f57c 100644
--- a/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c
+++ b/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c
@@ -231,7 +231,7 @@  struct	sta_info *rtw_alloc_stainfo(struct sta_priv *pstapriv, u8 *hwaddr)
 		list_del_init(&(psta->list));
 		spin_unlock_bh(&pfree_sta_queue->lock);
 		_rtw_init_stainfo(psta);
-		memcpy(psta->hwaddr, hwaddr, ETH_ALEN);
+		ether_addr_copy(psta->hwaddr, hwaddr);
 		index = wifi_mac_hash(hwaddr);
 		RT_TRACE(_module_rtl871x_sta_mgt_c_, _drv_info_, ("rtw_alloc_stainfo: index=%x", index));
 		if (index >= NUM_STA) {