[PATCH] wireless: libertas: fix unaligned accesses

Sebastian Andrzej Siewior sebastian at breakpoint.cc
Tue May 26 06:56:01 EDT 2009


* Mike Frysinger | 2009-05-26 06:26:22 [-0400]:

>--- a/drivers/net/wireless/libertas/cmdresp.c
>+++ b/drivers/net/wireless/libertas/cmdresp.c
>@@ -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));
are the extra () really required?

>-	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],
>diff --git a/drivers/net/wireless/libertas/scan.c b/drivers/net/wireless/libertas/scan.c
>index 8124db3..cc5c3ff 100644
>--- a/drivers/net/wireless/libertas/scan.c
>+++ b/drivers/net/wireless/libertas/scan.c
>@@ -1130,7 +1130,8 @@ static int lbs_ret_80211_scan(struct lbs_private *priv, unsigned long dummy,
> 		goto done;
> 	}
> 
>-	bytesleft = le16_to_cpu(scanresp->bssdescriptsize);
>+	/*bytesleft = le16_to_cpu(scanresp->bssdescriptsize);*/
that line can go, can't it?

>+	bytesleft = get_unaligned_le16(&(scanresp->bssdescriptsize));
> 	lbs_deb_scan("SCAN_RESP: bssdescriptsize %d\n", bytesleft);
> 
> 	scanrespsize = le16_to_cpu(resp->size);

Sebastian



More information about the libertas-dev mailing list