diff options
author | Jiri Benc <jbenc@suse.cz> | 2005-10-10 19:16:53 +0200 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2005-10-18 17:25:36 -0400 |
commit | 757d18faee58aa4c43bcaf9a44decf17fa68adeb (patch) | |
tree | 307ccb9b815b2b53ad79bb0b0bc5d17a6f39aed0 /net/ieee80211/ieee80211_wx.c | |
parent | 28af493cd7b89cba7e3ee534079cf4f41bb4b4f9 (diff) | |
download | op-kernel-dev-757d18faee58aa4c43bcaf9a44decf17fa68adeb.zip op-kernel-dev-757d18faee58aa4c43bcaf9a44decf17fa68adeb.tar.gz |
[PATCH] ieee80211: division by zero fix
This fixes division by zero bug in ieee80211_wx_get_scan().
Signed-off-by: Jiri Benc <jbenc@suse.cz>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
Diffstat (limited to 'net/ieee80211/ieee80211_wx.c')
-rw-r--r-- | net/ieee80211/ieee80211_wx.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/net/ieee80211/ieee80211_wx.c b/net/ieee80211/ieee80211_wx.c index ee7a70a..1ce7af9 100644 --- a/net/ieee80211/ieee80211_wx.c +++ b/net/ieee80211/ieee80211_wx.c @@ -152,15 +152,18 @@ static inline char *ipw2100_translate_scan(struct ieee80211_device *ieee, iwe.u.qual.level = 0; } else { iwe.u.qual.level = network->stats.rssi; - iwe.u.qual.qual = - (100 * - (ieee->perfect_rssi - ieee->worst_rssi) * - (ieee->perfect_rssi - ieee->worst_rssi) - - (ieee->perfect_rssi - network->stats.rssi) * - (15 * (ieee->perfect_rssi - ieee->worst_rssi) + - 62 * (ieee->perfect_rssi - network->stats.rssi))) / - ((ieee->perfect_rssi - ieee->worst_rssi) * - (ieee->perfect_rssi - ieee->worst_rssi)); + if (ieee->perfect_rssi == ieee->worst_rssi) + iwe.u.qual.qual = 100; + else + iwe.u.qual.qual = + (100 * + (ieee->perfect_rssi - ieee->worst_rssi) * + (ieee->perfect_rssi - ieee->worst_rssi) - + (ieee->perfect_rssi - network->stats.rssi) * + (15 * (ieee->perfect_rssi - ieee->worst_rssi) + + 62 * (ieee->perfect_rssi - network->stats.rssi))) / + ((ieee->perfect_rssi - ieee->worst_rssi) * + (ieee->perfect_rssi - ieee->worst_rssi)); if (iwe.u.qual.qual > 100) iwe.u.qual.qual = 100; else if (iwe.u.qual.qual < 1) |