summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAdrian Bunk <bunk@kernel.org>2007-10-14 19:51:15 +0200
committerJohn W. Linville <linville@tuxdriver.com>2007-10-18 15:44:42 -0400
commitc899a575fa9cc802a4a77f6c5078b14fc1d12487 (patch)
tree0dc2c257d8c259b5bcdc345db74ff30349555d88 /drivers
parentba8007ceb076f336a453a049cc5353eaa01d7136 (diff)
downloadop-kernel-dev-c899a575fa9cc802a4a77f6c5078b14fc1d12487.zip
op-kernel-dev-c899a575fa9cc802a4a77f6c5078b14fc1d12487.tar.gz
[PATCH] iwl4965-base.c: fix off-by-one errors
This patch fixes two off-by-one errors resulting in array overflows spotted by the Coverity checker. Signed-off-by: Adrian Bunk <bunk@kernel.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl4965-base.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c
index 7b0c602..acdf550 100644
--- a/drivers/net/wireless/iwlwifi/iwl4965-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c
@@ -4492,13 +4492,13 @@ static u8 ratio2dB[100] = {
* Conversion assumes that levels are voltages (20*log), not powers (10*log). */
int iwl_calc_db_from_ratio(int sig_ratio)
{
- /* Anything above 1000:1 just report as 60 dB */
- if (sig_ratio > 1000)
+ /* 1000:1 or higher just report as 60 dB */
+ if (sig_ratio >= 1000)
return 60;
- /* Above 100:1, divide by 10 and use table,
+ /* 100:1 or higher, divide by 10 and use table,
* add 20 dB to make up for divide by 10 */
- if (sig_ratio > 100)
+ if (sig_ratio >= 100)
return (20 + (int)ratio2dB[sig_ratio/10]);
/* We shouldn't see this */
OpenPOWER on IntegriCloud