netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [BRIDGE] Unaligned access on IA64 when comparing ethernet addresses
@ 2007-04-17 11:49 Pavel Emelianov
  2007-04-17 19:31 ` David Miller
  0 siblings, 1 reply; 17+ messages in thread
From: Pavel Emelianov @ 2007-04-17 11:49 UTC (permalink / raw)
  To: David Miller, shemminger, Linux Netdev List; +Cc: bridge, devel

From: Evgeny Kravtsunov <emkravts@openvz.org>

compare_ether_addr() implicitly requires that the addresses
passed are 2-bytes aligned in memory.

This is not true for br_stp_change_bridge_id() and
br_stp_recalculate_bridge_id() in which one of the addresses
is unsigned char *, and thus may not be 2-bytes aligned.

Signed-off-by: Evgeny Kravtsunov <emkravts@openvz.org>
Signed-off-by: Kirill Korotaev <dev@openvz.org>
Signed-off-by: Pavel Emelianov <xemul@openvz.org>

---

--- a/net/bridge/br_stp_if.c	2006-09-20 07:42:06.000000000 +0400
+++ b/net/bridge/br_stp_if.c	2007-04-13 12:28:08.000000000 +0400
@@ -124,7 +124,9 @@ void br_stp_disable_port(struct net_brid
 /* called under bridge lock */
 void br_stp_change_bridge_id(struct net_bridge *br, const unsigned char *addr)
 {
-	unsigned char oldaddr[6];
+	/* should be aligned on 2 bytes for compare_ether_addr() */
+	unsigned short oldaddr_aligned[ETH_ALEN >> 1];
+	unsigned char *oldaddr = (unsigned char *)oldaddr_aligned;
 	struct net_bridge_port *p;
 	int wasroot;
 
@@ -149,11 +151,14 @@ void br_stp_change_bridge_id(struct net_
 		br_become_root_bridge(br);
 }
 
-static const unsigned char br_mac_zero[6];
+/* should be aligned on 2 bytes for compare_ether_addr() */
+static const unsigned short br_mac_zero_aligned[ETH_ALEN >> 1];
 
 /* called under bridge lock */
 void br_stp_recalculate_bridge_id(struct net_bridge *br)
 {
+	const unsigned char *br_mac_zero =
+			(const unsigned char *)br_mac_zero_aligned;
 	const unsigned char *addr = br_mac_zero;
 	struct net_bridge_port *p;
 

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

end of thread, other threads:[~2007-04-19 20:30 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-04-17 11:49 [BRIDGE] Unaligned access on IA64 when comparing ethernet addresses Pavel Emelianov
2007-04-17 19:31 ` David Miller
2007-04-17 19:55   ` Stephen Hemminger
2007-04-17 20:09     ` David Miller
2007-04-17 20:37       ` Stephen Hemminger
2007-04-17 21:09         ` David Miller
2007-04-17 21:24           ` Eric Dumazet
2007-04-17 21:27             ` David Miller
2007-04-18  6:43         ` Pavel Emelianov
2007-04-18  8:28           ` David Miller
2007-04-18  8:37             ` Pavel Emelianov
2007-04-18 14:44             ` Stephen Hemminger
2007-04-18 20:04               ` David Miller
2007-04-19 14:14                 ` Eric Dumazet
2007-04-19 18:18                   ` Stephen Hemminger
2007-04-19 20:01                   ` [BRIDGE] " David Miller
2007-04-19 20:29                     ` Eric Dumazet

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