Re: Kernel 2.6.20.4 Unaligned address

From: David Miller
Date: Fri Apr 13 2007 - 19:35:46 EST


From: "doctor raid" <drraid@xxxxxxxxx>
Date: Tue, 10 Apr 2007 16:02:01 -0700

> [1] kernel errors reporting unaligned access of memory
> [2] The following two lines iterate twice a piece, about once every 2 minutes:
>
> Kernel unaligned access at TPC[79c344] arpt_do_table+0x3cc/0x640
> Kernel unaligned access at TPC[79c33c] arpt_do_table+0x3c4/0x640

This patch below should fix this problem.

Patrick I'm going to push this to Linus. Even if it doesn't
fix this person's problem, either both the input device loop
and the output device loop should use the "long" casting
optimization or both should not :-)

Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx>

diff --git a/net/ipv4/netfilter/arp_tables.c b/net/ipv4/netfilter/arp_tables.c
index 5170f5c..57b0221 100644
--- a/net/ipv4/netfilter/arp_tables.c
+++ b/net/ipv4/netfilter/arp_tables.c
@@ -166,13 +166,9 @@ static inline int arp_packet_match(const struct arphdr *arphdr,
return 0;
}

- for (i = 0, ret = 0; i < IFNAMSIZ/sizeof(unsigned long); i++) {
- unsigned long odev;
- memcpy(&odev, outdev + i*sizeof(unsigned long),
- sizeof(unsigned long));
- ret |= (odev
- ^ ((const unsigned long *)arpinfo->outiface)[i])
- & ((const unsigned long *)arpinfo->outiface_mask)[i];
+ for (i = 0, ret = 0; i < IFNAMSIZ; i++) {
+ ret |= (outdev[i] ^ arpinfo->outiface[i])
+ & arpinfo->outiface_mask[i];
}

if (FWINV(ret != 0, ARPT_INV_VIA_OUT)) {
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/