Re: [PATCH 2/4] Staging: rtl8712: Use ether_addr_equal() over memcmp()

From: Joe Perches
Date: Sun Oct 11 2015 - 13:23:40 EST


On Sun, 2015-10-11 at 16:42 +0530, punit vara wrote:
> following are the two structure need to be consider for alignment.
>
> struct iw_pmksa {
> __u32 cmd; /* 0 4 */
> struct sockaddr bssid; /* 4 16 */
> __u8 pmkid[16]; /* 20 16 */

wrong bssid, bssid here is on the stack
after a char *, so bssid is aligned on a
pointer boundary, either 4 or 8.

> /* size: 36, cachelines: 1, members: 3 */
> /* last cacheline: 36 bytes */
> };
>
> struct wlan_bssid_ex {
[]
> unsigned char MacAddress[6]; /* 4 6 */

> As I understood both are not aligned to u16 so
> ether_addr_equal_unaligned() should be used.

u16s are aligned when on any even address

So ether_addr_equal could be used.


--
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/