Re: [PATCH] staging: vt6656: Use ether_addr_copy() in vnt_fill_ieee80211_rts.

From: Krzysztof Adamski
Date: Tue Dec 16 2014 - 03:54:14 EST


On Tue, Dec 16, 2014 at 12:42:06AM -0800, Joe Perches wrote:
On Tue, 2014-12-16 at 09:30 +0100, Krzysztof Adamski wrote:
Both struct ieee80211_rts and struct ieee80211_hdr defined in
linux/ieee80211.h are declared as __aligned(2) so it is safe to use
ether_addr_copy() instead of memcpy().

Just fyi:

That the structure is declared __aligned(2) is not
the important bit. What's necessary is that the
members in the struct are __aligned(2).

In this case, all of these members are.

Hi,

Thank you for your feedback. Yes, you are right. It was a bit of a shortcut in my reasoning. Since struct is aligned and it's packed and both members preceding the array we want to copy are 16 bit large, the array address is guaranteed to be properly aligned.

Best regards,
Krzysztof Adamski
--
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/