summaryrefslogtreecommitdiff
path: root/drivers/net/wireless/intel/iwlegacy
diff options
context:
space:
mode:
authorColin Ian King <colin.king@canonical.com>2020-01-26 00:09:54 +0000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-02-28 15:42:39 +0100
commit88213ab3d0c9ba59233a6c8afa07ca5e662cebfa (patch)
tree4f9467dd5808a13a3adbd6dda8b8035231917223 /drivers/net/wireless/intel/iwlegacy
parent5dc3a54d0deab4ea01c7693baa666a81f50e22d4 (diff)
iwlegacy: ensure loop counter addr does not wrap and cause an infinite loop
[ Upstream commit c2f9a4e4a5abfc84c01b738496b3fd2d471e0b18 ] 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 <colin.king@canonical.com> Acked-by: Stanislaw Gruszka <stf_xl@wp.pl> Signed-off-by: Kalle Valo <kvalo@codeaurora.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/net/wireless/intel/iwlegacy')
-rw-r--r--drivers/net/wireless/intel/iwlegacy/common.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/net/wireless/intel/iwlegacy/common.c b/drivers/net/wireless/intel/iwlegacy/common.c
index 140b6ea8f7cc..db2373fe8ac3 100644
--- a/drivers/net/wireless/intel/iwlegacy/common.c
+++ b/drivers/net/wireless/intel/iwlegacy/common.c
@@ -717,7 +717,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;