Skip to content

Commit

Permalink
iwlegacy: ensure loop counter addr does not wrap and cause an infinit…
Browse files Browse the repository at this point in the history
…e loop

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: be663ab ("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>
  • Loading branch information
Colin Ian King authored and Kalle Valo committed Jan 26, 2020
1 parent f76c340 commit c2f9a4e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/net/wireless/intel/iwlegacy/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit c2f9a4e

Please sign in to comment.