Skip to content

Commit

Permalink
ath9k_hw: index out of bounds
Browse files Browse the repository at this point in the history
Check whether index is within bounds before testing the element

Both spurChans arrays in modalHeader5G and modalHeader2G have 5 elements,
AR_EEPROM_MODAL_SPURS is defined 5. So unless a break occurs, in the
last iteration (i=5) we tried to access spurChansPtr[5] before testing
whether i was within bounds. Fix this.

Signed-off-by: Roel Kluin <[email protected]>
Signed-off-by: John W. Linville <[email protected]>
  • Loading branch information
RoelKluin authored and linvjw committed Apr 12, 2011
1 parent c266c71 commit 0f8e94d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/net/wireless/ath/ath9k/ar9003_phy.c
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ static void ar9003_hw_spur_mitigate_ofdm(struct ath_hw *ah,

ar9003_hw_spur_ofdm_clear(ah);

for (i = 0; spurChansPtr[i] && i < 5; i++) {
for (i = 0; i < AR_EEPROM_MODAL_SPURS && spurChansPtr[i]; i++) {
freq_offset = FBIN2FREQ(spurChansPtr[i], mode) - synth_freq;
if (abs(freq_offset) < range) {
ar9003_hw_spur_ofdm_work(ah, chan, freq_offset);
Expand Down

0 comments on commit 0f8e94d

Please sign in to comment.