[PATCH] staging: vt6656: fix Prefer ether_addr_copy() over memcpy() if the Ethernet addresses are __aligned(2)

Joe Perches joe at perches.com
Wed Jan 21 15:55:24 UTC 2015


On Wed, 2015-01-21 at 18:44 +0200, Lin Kassem wrote:
> This patch fixes the following checkpatch.pl warning:
> fix Prefer ether_addr_copy() over memcpy() 
> if the Ethernet addresses are __aligned(2)
> 
> Pahole showed that the 2 structs are aligned to u16
[]
> diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c
[]
> @@ -749,7 +749,7 @@ static void vnt_fill_txkey(struct vnt_usb_send_context *tx_context,
>  		else
>  			mic_hdr->hlen = cpu_to_be16(22);
>  
> -		memcpy(mic_hdr->addr1, hdr->addr1, ETH_ALEN);
> +		ether_addr_copy(mic_hdr->addr1, hdr->addr1);
>  		memcpy(mic_hdr->addr2, hdr->addr2, ETH_ALEN);
>  		memcpy(mic_hdr->addr3, hdr->addr3, ETH_ALEN);
>  

Why would you modify only one of these?
Please modify all 4.




More information about the devel mailing list