[PATCH v3 03/33] staging: rtl8192e: Mark unaligned memcpy()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Comment unaligned memcpy() that trigger PREFER_ETHER_ADDR_COPY
checkpatch.pl warning.
It will prevent accidential "Fix" to ether_addr_copy().

Signed-off-by: Mateusz Kulikowski <mateusz.kulikowski@xxxxxxxxx>
---
 drivers/staging/rtl8192e/rtllib_rx.c | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtllib_rx.c b/drivers/staging/rtl8192e/rtllib_rx.c
index ebb328d..65e4d13 100644
--- a/drivers/staging/rtl8192e/rtllib_rx.c
+++ b/drivers/staging/rtl8192e/rtllib_rx.c
@@ -488,15 +488,19 @@ void rtllib_indicate_packets(struct rtllib_device *ieee, struct rtllib_rxb **prx
 				 * and replace EtherType
 				 */
 				skb_pull(sub_skb, SNAP_SIZE);
-				memcpy(skb_push(sub_skb, ETH_ALEN), prxb->src, ETH_ALEN);
-				memcpy(skb_push(sub_skb, ETH_ALEN), prxb->dst, ETH_ALEN);
+				memcpy(skb_push(sub_skb, ETH_ALEN), prxb->src,
+				       ETH_ALEN); /* Must be unaligned */
+				memcpy(skb_push(sub_skb, ETH_ALEN), prxb->dst,
+				       ETH_ALEN); /* Must be unaligned */
 			} else {
 				u16 len;
 			/* Leave Ethernet header part of hdr and full payload */
 				len = sub_skb->len;
 				memcpy(skb_push(sub_skb, 2), &len, 2);
-				memcpy(skb_push(sub_skb, ETH_ALEN), prxb->src, ETH_ALEN);
-				memcpy(skb_push(sub_skb, ETH_ALEN), prxb->dst, ETH_ALEN);
+				memcpy(skb_push(sub_skb, ETH_ALEN), prxb->src,
+				       ETH_ALEN); /* Must be unaligned */
+				memcpy(skb_push(sub_skb, ETH_ALEN), prxb->dst,
+				       ETH_ALEN); /* Must be unaligned */
 			}
 
 			/* Indicate the packets to upper layer */
@@ -781,15 +785,15 @@ static u8 parse_subframe(struct rtllib_device *ieee, struct sk_buff *skb,
 
 		rxb->subframes[0] = sub_skb;
 
-		memcpy(rxb->src, src, ETH_ALEN);
-		memcpy(rxb->dst, dst, ETH_ALEN);
+		memcpy(rxb->src, src, ETH_ALEN); /* Must stay unaligned */
+		memcpy(rxb->dst, dst, ETH_ALEN); /* Must stay unaligned */
 		rxb->subframes[0]->dev = ieee->dev;
 		return 1;
 	}
 
 	rxb->nr_subframes = 0;
-	memcpy(rxb->src, src, ETH_ALEN);
-	memcpy(rxb->dst, dst, ETH_ALEN);
+	memcpy(rxb->src, src, ETH_ALEN); /* Must stay unaligned */
+	memcpy(rxb->dst, dst, ETH_ALEN); /* Must stay unaligned */
 	while (skb->len > ETHERNET_HEADER_SIZE) {
 		/* Offset 12 denote 2 mac address */
 		nSubframe_Length = *((u16 *)(skb->data + 12));
-- 
1.8.4.1

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux