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

Commit 8d175631 authored by Dan Carpenter's avatar Dan Carpenter Committed by Greg Kroah-Hartman
Browse files

wifi: ath5k: fix an off by one check in ath5k_eeprom_read_freq_list()



[ Upstream commit 4c856ee12df85aabd437c3836ed9f68d94268358 ]

This loop checks that i < max at the start of loop but then it does
i++ which could put it past the end of the array.  It's harmless to
check again and prevent a potential out of bounds.

Fixes: 1048643e ("ath5k: Clean up eeprom parsing and add missing calibration data")
Signed-off-by: default avatarDan Carpenter <error27@gmail.com>
Reviewed-by: default avatarLuis Chamberlain <mcgrof@kernel.org>
Signed-off-by: default avatarKalle Valo <quic_kvalo@quicinc.com>
Link: https://lore.kernel.org/r/Y+D9hPQrHfWBJhXz@kili


Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent d9899318
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -529,7 +529,7 @@ ath5k_eeprom_read_freq_list(struct ath5k_hw *ah, int *offset, int max,
		ee->ee_n_piers[mode]++;

		freq2 = (val >> 8) & 0xff;
		if (!freq2)
		if (!freq2 || i >= max)
			break;

		pc[i++].freq = ath5k_eeprom_bin2freq(ee,