Search Linux Wireless

Re: [PATCH] mac80211: fix alignment issue with compare_ether_addr()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, May 28, 2008 at 08:20:48PM +0530, Senthil Balasubramanian wrote:
> This addresses an alignment issue with compare_ether_addr().
> The addresses passed to compare_ether_addr should be two bytes aligned.
> It may function properly in x86 platform. However may not work properly
> on IA-64 or ARM processor.

> --- a/net/mac80211/rx.c
> +++ b/net/mac80211/rx.c
> @@ -1116,7 +1116,9 @@ ieee80211_data_to_8023(struct ieee80211_rx_data *rx)
>  	u16 fc, hdrlen, ethertype;
>  	u8 *payload;
>  	u8 dst[ETH_ALEN];
> -	u8 src[ETH_ALEN];
> +	/* Should be aligned on 2 bytes for compare_ether_addr() */
> +	u16 src_aligned[ETH_ALEN >> 1];
> +	u8 *src = (u8 *)src_aligned;
>  	struct sk_buff *skb = rx->skb;
>  	struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
>  	DECLARE_MAC_BUF(mac);

Any reason you couldn't just do this?

@@ -1116,7 +1116,7 @@ ieee80211_data_to_8023(struct ieee80211_rx_data *rx)
 	u16 fc, hdrlen, ethertype;
 	u8 *payload;
 	u8 dst[ETH_ALEN];
-	u8 src[ETH_ALEN];
+	u8 src[ETH_ALEN] __attribute__ ((aligned(2)));
 	struct sk_buff *skb = rx->skb;
 	struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
 	DECLARE_MAC_BUF(mac);

It seems to compile w/o errors on i686, and it seems more clear to me.
Will that not work?

John
-- 
John W. Linville
linville@xxxxxxxxxxxxx
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux