netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V3.18] rtlwifi: Fix possible unaligned array in ether_addr_copy()
@ 2014-10-08 17:44 Larry Finger
  2014-10-08 19:00 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Larry Finger @ 2014-10-08 17:44 UTC (permalink / raw)
  To: linville; +Cc: linux-wireless, troy_tan, Larry Finger, netdev

Two macros used to copy BSSID information use ether_addr_copy(), thus
the arrays must be 2-byte aligned. In one case, the array could become
unaligned if the struct containing it were changed. Use the __unaligned(2)
attribute to retain the necessary alignment. In addition, the magic number
used to specify the size of the array is replaced by ETH_ALEN.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
---
 drivers/net/wireless/rtlwifi/wifi.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/rtlwifi/wifi.h b/drivers/net/wireless/rtlwifi/wifi.h
index 976667a..6866dcf 100644
--- a/drivers/net/wireless/rtlwifi/wifi.h
+++ b/drivers/net/wireless/rtlwifi/wifi.h
@@ -1370,7 +1370,7 @@ struct rtl_mac {
 	bool rdg_en;
 
 	/*AP*/
-	u8 bssid[6];
+	u8 bssid[ETH_ALEN] __aligned(2);
 	u32 vendor;
 	u8 mcs[16];	/* 16 bytes mcs for HT rates. */
 	u32 basic_rates; /* b/g rates */
-- 
1.8.4.5

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

* Re: [PATCH V3.18] rtlwifi: Fix possible unaligned array in ether_addr_copy()
  2014-10-08 17:44 [PATCH V3.18] rtlwifi: Fix possible unaligned array in ether_addr_copy() Larry Finger
@ 2014-10-08 19:00 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2014-10-08 19:00 UTC (permalink / raw)
  To: Larry.Finger; +Cc: linville, linux-wireless, troy_tan, netdev

From: Larry Finger <Larry.Finger@lwfinger.net>
Date: Wed,  8 Oct 2014 12:44:55 -0500

> Two macros used to copy BSSID information use ether_addr_copy(), thus
> the arrays must be 2-byte aligned. In one case, the array could become
> unaligned if the struct containing it were changed. Use the __unaligned(2)
> attribute to retain the necessary alignment. In addition, the magic number
> used to specify the size of the array is replaced by ETH_ALEN.
> 
> Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>

Acked-by: David S. Miller <davem@davemloft.net>

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

end of thread, other threads:[~2014-10-08 19:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-08 17:44 [PATCH V3.18] rtlwifi: Fix possible unaligned array in ether_addr_copy() Larry Finger
2014-10-08 19:00 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).