netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* ZD1211RW unaligned accesses...
@ 2007-11-20 12:05 David Miller
       [not found] ` <20071120.040546.222294375.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
  0 siblings, 1 reply; 11+ messages in thread
From: David Miller @ 2007-11-20 12:05 UTC (permalink / raw)
  To: linux-wireless; +Cc: netdev, shaddy_baddah


The problem is drivers/net/wireless/zd1211/zd_mac.c:update_qual_rssi().
Specifically the compare_ether_addr() call.  Now, ieee80211_hdr_3addr
is marked with attribute((unaligned)) but compare_ether_addr() does
not know that and does "u16 *" dereferences in the optimized
comparison.

Shaddy I attach a hack patch that you can use which should get
rid of the warnings.

Wireless folks, I would suggest we do some auditing of the
compare_ether_addr() calls and for the ones that are operating
on these potentially unaligned structs we change it to either
a straight memcmp() or some new routine which will more reflect
the issue (say something like "compare_ether_addr_unaligned()"
or "ieee80211_compare_ether_addr()").

diff --git a/drivers/net/wireless/zd1211rw/zd_mac.c b/drivers/net/wireless/zd1211rw/zd_mac.c
index a903645..4999869 100644
--- a/drivers/net/wireless/zd1211rw/zd_mac.c
+++ b/drivers/net/wireless/zd1211rw/zd_mac.c
@@ -1047,8 +1047,13 @@ static void update_qual_rssi(struct zd_mac *mac,
 	hdr = (struct ieee80211_hdr_3addr *)buffer;
 	if (length < offsetof(struct ieee80211_hdr_3addr, addr3))
 		return;
+#if 1
+	if (memcmp(hdr->addr2, zd_mac_to_ieee80211(mac)->bssid, ETH_ALEN))
+		return;
+#else
 	if (compare_ether_addr(hdr->addr2, zd_mac_to_ieee80211(mac)->bssid) != 0)
 		return;
+#endif
 
 	spin_lock_irqsave(&mac->lock, flags);
 	i = mac->stats_count % ZD_MAC_STATS_BUFFER_SIZE;

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

end of thread, other threads:[~2007-12-01 10:33 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-20 12:05 ZD1211RW unaligned accesses David Miller
     [not found] ` <20071120.040546.222294375.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
2007-11-21 13:00   ` Shaddy Baddah
     [not found]     ` <47442BFC.8090008-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org>
2007-11-24 15:02       ` Herbert Xu
     [not found]         ` <20071124150216.GA28153-lOAM2aK0SrRLBo1qDEOMRrpzq4S04n8Q@public.gmane.org>
2007-11-24 16:52           ` Ulrich Kunitz
2007-11-29 21:45         ` John W. Linville
     [not found]           ` <20071129214533.GD32730-2XuSBdqkA4R54TAoqtyWWQ@public.gmane.org>
2007-11-29 23:43             ` Herbert Xu
     [not found]               ` <20071129234327.GA23769-lOAM2aK0SrRLBo1qDEOMRrpzq4S04n8Q@public.gmane.org>
2007-11-30  7:34                 ` Shaddy Baddah
2007-11-30  9:50                   ` Herbert Xu
2007-11-30 11:33                 ` Johannes Berg
2007-12-01 10:33             ` Ulrich Kunitz
2007-11-23 10:41   ` Johannes Berg

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).