wireless: libertas: fix unaligned accesses
authorCliff Cai <cliff.cai@analog.com>
Wed, 27 May 2009 18:03:09 +0000 (14:03 -0400)
committerJohn W. Linville <linville@tuxdriver.com>
Wed, 3 Jun 2009 18:05:11 +0000 (14:05 -0400)
Signed-off-by: Cliff Cai <cliff.cai@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Bryan Wu <cooloney@kernel.org>
Acked-by: Dan Williams <dcbw@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/libertas/cmdresp.c
drivers/net/wireless/libertas/scan.c

index 14b3d562db09c3121850538ac7298443e72a8f30..c42d3faa2660208c556cc66adabff7071b206782 100644 (file)
@@ -5,7 +5,7 @@
 #include <linux/delay.h>
 #include <linux/if_arp.h>
 #include <linux/netdevice.h>
-
+#include <asm/unaligned.h>
 #include <net/iw_handler.h>
 
 #include "host.h"
@@ -154,11 +154,11 @@ static int lbs_ret_802_11_rssi(struct lbs_private *priv,
        lbs_deb_enter(LBS_DEB_CMD);
 
        /* store the non average value */
-       priv->SNR[TYPE_BEACON][TYPE_NOAVG] = le16_to_cpu(rssirsp->SNR);
-       priv->NF[TYPE_BEACON][TYPE_NOAVG] = le16_to_cpu(rssirsp->noisefloor);
+       priv->SNR[TYPE_BEACON][TYPE_NOAVG] = get_unaligned_le16(&rssirsp->SNR);
+       priv->NF[TYPE_BEACON][TYPE_NOAVG] = get_unaligned_le16(&rssirsp->noisefloor);
 
-       priv->SNR[TYPE_BEACON][TYPE_AVG] = le16_to_cpu(rssirsp->avgSNR);
-       priv->NF[TYPE_BEACON][TYPE_AVG] = le16_to_cpu(rssirsp->avgnoisefloor);
+       priv->SNR[TYPE_BEACON][TYPE_AVG] = get_unaligned_le16(&rssirsp->avgSNR);
+       priv->NF[TYPE_BEACON][TYPE_AVG] = get_unaligned_le16(&rssirsp->avgnoisefloor);
 
        priv->RSSI[TYPE_BEACON][TYPE_NOAVG] =
            CAL_RSSI(priv->SNR[TYPE_BEACON][TYPE_NOAVG],
index e5e30b24cf023a360938537cab0a8a78311c2609..601b54249677412cd5f797be38311dbfcfdf20b4 100644 (file)
@@ -1129,7 +1129,7 @@ static int lbs_ret_80211_scan(struct lbs_private *priv, unsigned long dummy,
                goto done;
        }
 
-       bytesleft = le16_to_cpu(scanresp->bssdescriptsize);
+       bytesleft = get_unaligned_le16(&scanresp->bssdescriptsize);
        lbs_deb_scan("SCAN_RESP: bssdescriptsize %d\n", bytesleft);
 
        scanrespsize = le16_to_cpu(resp->size);