Re: [PATCH 4/11] use ether_addr_equal_64bits
From: Eric Dumazet
Date: Mon Jan 06 2014 - 10:18:49 EST
On Mon, 2014-01-06 at 10:24 +0100, Geert Uytterhoeven wrote:
> Thanks to this discussion, my eye fell on:
> static inline unsigned compare_ether_addr(const u8 *addr1, const u8 *addr2)
> const u16 *a = (const u16 *) addr1;
> const u16 *b = (const u16 *) addr2;
> BUILD_BUG_ON(ETH_ALEN != 6);
> return ((a ^ b) | (a ^ b) | (a ^ b)) != 0;
> What if addr1 or addr2 are odd, and this is running on an architecture that
> doesn't support unaligned accesses at all?? Have we been lucky forever?
This function always had the guarantee of u16 alignment.
No protocol ever included an ether address at an odd alignment, and
drivers always make sure a frame is at least 2-byte aligned.
Its kind of obvious for networking people, Stephen did not mention this
property in commit 360ac8e2f1a38c34
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/