blob: c272e415ed220a0247056c25018d32753f9928a5 [file] [log] [blame]
From da730de07cec7b237adb909bab37eb446715a6b1 Mon Sep 17 00:00:00 2001
From: Colin Ian King <>
Date: Sun, 26 Jan 2020 00:09:54 +0000
Subject: [PATCH] iwlegacy: ensure loop counter addr does not wrap and cause an
infinite loop
commit c2f9a4e4a5abfc84c01b738496b3fd2d471e0b18 upstream.
The loop counter addr is a u16 where as the upper limit of the loop
is an int. In the unlikely event that the il->cfg->eeprom_size is
greater than 64K then we end up with an infinite loop since addr will
wrap around an never reach upper loop limit. Fix this by making addr
an int.
Addresses-Coverity: ("Infinite loop")
Fixes: be663ab67077 ("iwlwifi: split the drivers for agn and legacy devices 3945/4965")
Signed-off-by: Colin Ian King <>
Acked-by: Stanislaw Gruszka <>
Signed-off-by: Kalle Valo <>
Signed-off-by: Paul Gortmaker <>
diff --git a/drivers/net/wireless/intel/iwlegacy/common.c b/drivers/net/wireless/intel/iwlegacy/common.c
index 4a88e35d58d7..4f0bdf152938 100644
--- a/drivers/net/wireless/intel/iwlegacy/common.c
+++ b/drivers/net/wireless/intel/iwlegacy/common.c
@@ -699,7 +699,7 @@ il_eeprom_init(struct il_priv *il)
u32 gp = _il_rd(il, CSR_EEPROM_GP);
int sz;
int ret;
- u16 addr;
+ int addr;
/* allocate eeprom */
sz = il->cfg->eeprom_size;