aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/airo.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2007-12-19 19:20:12 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 18:08:50 -0500
commit851b3e5e3de0feea7bfee634f99a940648de58c8 (patch)
tree032fb6cc78ea998127aa9cd81acd718dad8ac81f /drivers/net/wireless/airo.c
parent977b143c13e685081625704ac356b741d71c6a73 (diff)
airo: fix endianness bug in ->dBm handling
airo_translate_scan() reads BSSListRid directly, does _not_ byteswap and uses ->dBm (__le16) as host-endian. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/airo.c')
-rw-r--r--drivers/net/wireless/airo.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c
index 24fa0d62efe4..6d4cc684afa6 100644
--- a/drivers/net/wireless/airo.c
+++ b/drivers/net/wireless/airo.c
@@ -7239,6 +7239,7 @@ static inline char *airo_translate_scan(struct net_device *dev,
7239 char * current_val; /* For rates */ 7239 char * current_val; /* For rates */
7240 int i; 7240 int i;
7241 char * buf; 7241 char * buf;
7242 u16 dBm;
7242 7243
7243 /* First entry *MUST* be the AP MAC address */ 7244 /* First entry *MUST* be the AP MAC address */
7244 iwe.cmd = SIOCGIWAP; 7245 iwe.cmd = SIOCGIWAP;
@@ -7277,16 +7278,18 @@ static inline char *airo_translate_scan(struct net_device *dev,
7277 iwe.u.freq.e = 1; 7278 iwe.u.freq.e = 1;
7278 current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe, IW_EV_FREQ_LEN); 7279 current_ev = iwe_stream_add_event(current_ev, end_buf, &iwe, IW_EV_FREQ_LEN);
7279 7280
7281 dBm = le16_to_cpu(bss->dBm);
7282
7280 /* Add quality statistics */ 7283 /* Add quality statistics */
7281 iwe.cmd = IWEVQUAL; 7284 iwe.cmd = IWEVQUAL;
7282 if (ai->rssi) { 7285 if (ai->rssi) {
7283 iwe.u.qual.level = 0x100 - bss->dBm; 7286 iwe.u.qual.level = 0x100 - dBm;
7284 iwe.u.qual.qual = airo_dbm_to_pct( ai->rssi, bss->dBm ); 7287 iwe.u.qual.qual = airo_dbm_to_pct(ai->rssi, dBm);
7285 iwe.u.qual.updated = IW_QUAL_QUAL_UPDATED 7288 iwe.u.qual.updated = IW_QUAL_QUAL_UPDATED
7286 | IW_QUAL_LEVEL_UPDATED 7289 | IW_QUAL_LEVEL_UPDATED
7287 | IW_QUAL_DBM; 7290 | IW_QUAL_DBM;
7288 } else { 7291 } else {
7289 iwe.u.qual.level = (bss->dBm + 321) / 2; 7292 iwe.u.qual.level = (dBm + 321) / 2;
7290 iwe.u.qual.qual = 0; 7293 iwe.u.qual.qual = 0;
7291 iwe.u.qual.updated = IW_QUAL_QUAL_INVALID 7294 iwe.u.qual.updated = IW_QUAL_QUAL_INVALID
7292 | IW_QUAL_LEVEL_UPDATED 7295 | IW_QUAL_LEVEL_UPDATED