Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a2763f62 authored by Colin Ian King's avatar Colin Ian King Committed by Greg Kroah-Hartman
Browse files

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: be663ab6 ("iwlwifi: split the drivers for agn and legacy devices 3945/4965")
Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
Acked-by: default avatarStanislaw Gruszka <stf_xl@wp.pl>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 034c5f26
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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;