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

From: Joe Perches
Date: Wed Jan 21 2015 - 10:55:48 EST


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.


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/