All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/5] Replace memcpy with ether_addr_copy and fix checkpatch warning
@ 2015-03-18 13:43 Darshana Padmadas
  2015-03-18 13:43 ` [PATCH v2 1/5] Staging: rtl8192e: Replace memcpy with ether_addr_copy Darshana Padmadas
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: Darshana Padmadas @ 2015-03-18 13:43 UTC (permalink / raw)
  To: outreachy-kernel; +Cc: Darshana Padmadas

This patch set replaces memcpy with ether_addr_copy if the
addresses of the structures are aligned. Structure layout is
shown by using the Pahole tool.

This patch set fixes the following warning reported by checkpatch:
WARNING: Prefer ether_addr_copy() over memcpy() if the Ethernet addresses are __aligned(2)

Darshana Padmadas (5):
Changes in v2:
  - Included header files that define ether_addr_copy in 
    patch 1/5 and 2/5.
  - Edited the commit message more clear in 1/5 and 2/5.
  
  Staging: rtl8192e: Replace memcpy with ether_addr_copy
  Staging: rtl8192e: Use ether_addr_copy instead of memcpy
  Staging: rtl8192e: Use ether_addr_copy replacing memcpy
  Staging: rtl8192e: Use ether_addr_copy for aligned addresses
  Staging: rtl8192e: replace memcpy with ether_addr_copy for aligned
    structures

 drivers/staging/rtl8192e/rtl819x_BAProc.c    |  5 +++--
 drivers/staging/rtl8192e/rtllib_crypt_tkip.c | 12 +++++------
 drivers/staging/rtl8192e/rtllib_rx.c         | 32 ++++++++++++++--------------
 drivers/staging/rtl8192e/rtllib_softmac.c    | 12 +++++------
 drivers/staging/rtl8192e/rtllib_tx.c         |  6 +++---
 5 files changed, 34 insertions(+), 33 deletions(-)

-- 
1.9.1



^ permalink raw reply	[flat|nested] 9+ messages in thread
* [PATCH 1/5] Staging: rtl8192e: Replace memcpy with ether_addr_copy
@ 2015-03-16 19:18 Darshana Padmadas
  2015-03-18 12:34 ` [PATCH v2 " Darshana Padmadas
  0 siblings, 1 reply; 9+ messages in thread
From: Darshana Padmadas @ 2015-03-16 19:18 UTC (permalink / raw)
  To: outreachy-kernel; +Cc: Darshana Padmadas

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



^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2015-03-20 14:40 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-18 13:43 [PATCH v2 0/5] Replace memcpy with ether_addr_copy and fix checkpatch warning Darshana Padmadas
2015-03-18 13:43 ` [PATCH v2 1/5] Staging: rtl8192e: Replace memcpy with ether_addr_copy Darshana Padmadas
2015-03-20 12:10   ` [Outreachy kernel] " Greg KH
2015-03-18 13:43 ` [PATCH v2 2/5] Staging: rtl8192e: Use ether_addr_copy instead of memcpy Darshana Padmadas
2015-03-18 13:43 ` [PATCH v2 3/5] Staging: rtl8192e: Use ether_addr_copy replacing memcpy Darshana Padmadas
2015-03-18 13:43 ` [PATCH v2 4/5] Staging: rtl8192e: Use ether_addr_copy for aligned addresses Darshana Padmadas
2015-03-20 11:01   ` Darshana Padmadas
2015-03-18 13:43 ` [PATCH v2 5/5] Staging: rtl8192e: replace memcpy with ether_addr_copy for aligned structures Darshana Padmadas
  -- strict thread matches above, loose matches on Subject: below --
2015-03-16 19:18 [PATCH 1/5] Staging: rtl8192e: Replace memcpy with ether_addr_copy Darshana Padmadas
2015-03-18 12:34 ` [PATCH v2 " Darshana Padmadas
2015-03-18 12:36   ` [Outreachy kernel] " Julia Lawall

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.