All of lore.kernel.org
 help / color / mirror / Atom feed
From: Darshana Padmadas <darshanapadmadas@gmail.com>
To: outreachy-kernel@googlegroups.com
Cc: Darshana Padmadas <darshanapadmadas@gmail.com>
Subject: [PATCH 1/5] Staging: rtl8192e: Replace memcpy with ether_addr_copy
Date: Tue, 17 Mar 2015 00:48:11 +0530	[thread overview]
Message-ID: <07d5dca03ac0a1d777e133546e2f914e36efeb3f.1426533157.git.darshanapadmadas@gmail.com> (raw)
In-Reply-To: <cover.1426533157.git.darshanapadmadas@gmail.com>
In-Reply-To: <cover.1426533157.git.darshanapadmadas@gmail.com>

This patch fixes the following warning found by checkpatch.pl:
Prefer ether_addr_copy() over memcpy() if the Ethernet addresses are __aligned(2

Pahole showed that the structure for BAReq and Delba is aligned:
struct rtllib_hdr_3addr {
	__le16                     frame_ctl;            /*     0     2 */
	__le16                     duration_id;          /*     2     2 */
	u8                         addr1[6];             /*     4     6 */
	u8                         addr2[6];             /*    10     6 */
	u8                         addr3[6];             /*    16     6 */
	__le16                     seq_ctl;              /*    22     2 */
	u8                         payload[0];           /*    24     0 */

	/* size: 24, cachelines: 1, members: 7 */
	/* last cacheline: 24 bytes */
};

Signed-off-by: Darshana Padmadas <darshanapadmadas@gmail.com>
---
 drivers/staging/rtl8192e/rtl819x_BAProc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtl819x_BAProc.c b/drivers/staging/rtl8192e/rtl819x_BAProc.c
index 0415e02..9bab409 100644
--- a/drivers/staging/rtl8192e/rtl819x_BAProc.c
+++ b/drivers/staging/rtl8192e/rtl819x_BAProc.c
@@ -103,7 +103,7 @@ static struct sk_buff *rtllib_ADDBA(struct rtllib_device *ieee, u8 *Dst,
 	BAReq = (struct rtllib_hdr_3addr *)skb_put(skb,
 		 sizeof(struct rtllib_hdr_3addr));
 
-	memcpy(BAReq->addr1, Dst, ETH_ALEN);
+	ether_addr_copy(BAReq->addr1, Dst);
 	memcpy(BAReq->addr2, ieee->dev->dev_addr, ETH_ALEN);
 
 	memcpy(BAReq->addr3, ieee->current_network.bssid, ETH_ALEN);
@@ -168,7 +168,7 @@ static struct sk_buff *rtllib_DELBA(struct rtllib_device *ieee, u8 *dst,
 	Delba = (struct rtllib_hdr_3addr *) skb_put(skb,
 		 sizeof(struct rtllib_hdr_3addr));
 
-	memcpy(Delba->addr1, dst, ETH_ALEN);
+	ether_addr_copy(Delba->addr1, dst);
 	memcpy(Delba->addr2, ieee->dev->dev_addr, ETH_ALEN);
 	memcpy(Delba->addr3, ieee->current_network.bssid, ETH_ALEN);
 	Delba->frame_ctl = cpu_to_le16(RTLLIB_STYPE_MANAGE_ACT);
-- 
1.9.1



  reply	other threads:[~2015-03-16 19:18 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-16 19:18 [PATCH 0/5] Replace memcpy with ether_addr_copy and fix checkpatch warning Darshana Padmadas
2015-03-16 19:18 ` Darshana Padmadas [this message]
     [not found]   ` <cover.1426681038.git.darshanapadmadas@gmail.com>
2015-03-18 12:34     ` [PATCH v2 1/5] Staging: rtl8192e: Replace memcpy with ether_addr_copy Darshana Padmadas
2015-03-18 12:36       ` [Outreachy kernel] " Julia Lawall
2015-03-18 12:35     ` [PATCH v2 2/5] Staging: rtl8192e: Use ether_addr_copy instead of memcpy Darshana Padmadas
2015-03-18 13:01       ` [PATCH v3 " Darshana Padmadas
2015-03-16 19:18 ` [PATCH " Darshana Padmadas
2015-03-16 19:18 ` [PATCH 3/5] Staging: rtl8192e: Use ether_addr_copy replacing memcpy Darshana Padmadas
2015-03-16 19:18 ` [PATCH 4/5] Staging: rtl8192e: Use ether_addr_copy for aligned addresses Darshana Padmadas
2015-03-16 19:18 ` [PATCH 5/5] Staging: rtl8192e: replace memcpy with ether_addr_copy for aligned structures Darshana Padmadas
2015-03-17 15:33 ` [Outreachy kernel] [PATCH 0/5] Replace memcpy with ether_addr_copy and fix checkpatch warning Jes Sorensen
2015-03-18 10:19 ` Greg KH
2015-03-18 13:05   ` Darshana Padmadas
2015-03-18 13:37     ` Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=07d5dca03ac0a1d777e133546e2f914e36efeb3f.1426533157.git.darshanapadmadas@gmail.com \
    --to=darshanapadmadas@gmail.com \
    --cc=outreachy-kernel@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.