staging: vt6655: card.c: replace memcpy() by ether_addr_copy() using coccinelle

Author: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>

This patch focuses on fixing the following warning generated
by checkpatch.pl for the file rxtx.c :

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

The changes were applied using the following coccinelle rule:

@@ expression e1, e2; @@

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

According to ether_addr_copy() description and functionality,
all Ethernet addresses should align to the u16 datatype.

Here is the output of pahole for the relevant datastructures:

struct pmkid_candidate {
        NDIS_802_11_MAC_ADDRESS    BSSID;                /*     0     6 */

        /* XXX 2 bytes hole, try to pack */

        long unsigned int          Flags;                /*     8     4 */

        /* size: 12, cachelines: 1, members: 2 */
        /* sum members: 10, holes: 1, sum holes: 2 */
        /* last cacheline: 12 bytes */
};

Signed-off-by: Aya Mahfouz 
Signed-off-by: Greg Kroah-Hartman 
---
 drivers/staging/vt6655/card.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
 
diff --git a/drivers/staging/vt6655/card.c b/drivers/staging/vt6655/card.c
index 5a69502..f2a33a9 100644
--- a/drivers/staging/vt6655/card.c
+++ b/drivers/staging/vt6655/card.c
@@ -1000,7 +1000,7 @@ CARDbAdd_PMKID_Candidate(
 	else
 		pCandidateList->Flags &= ~(NDIS_802_11_PMKID_CANDIDATE_PREAUTH_ENABLED);
 
-	memcpy(pCandidateList->BSSID, pbyBSSID, ETH_ALEN);
+	ether_addr_copy(pCandidateList->BSSID, pbyBSSID);
 	pDevice->gsPMKIDCandidate.NumCandidates++;
 	pr_debug("NumCandidates:%d\n",
 		 (int)pDevice->gsPMKIDCandidate.NumCandidates);
BtrLinux
Résumé de la politique de confidentialité

Ce site utilise des cookies afin que nous puissions vous fournir la meilleure expérience utilisateur possible. Les informations sur les cookies sont stockées dans votre navigateur et remplissent des fonctions telles que vous reconnaître lorsque vous revenez sur notre site Web et aider notre équipe à comprendre les sections du site que vous trouvez les plus intéressantes et utiles.