Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ath5k: fix hw rate index condition

Make sure we print out a warning when the index is out of bounds,
i.e. even on hw_rix == AR5K_MAX_RATES.

Also change to WARN and print text with the reported hw_rix.

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Cc: Nick Kossifidis <mickflemm@gmail.com>
Cc: Luis R. Rodriguez <lrodriguez@atheros.com>
Cc: Bob Copeland <me@bobcopeland.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>

authored by

Jiri Slaby and committed by
John W. Linville
db5b4f7a 3f53dd64

+2 -1
+2 -1
drivers/net/wireless/ath5k/base.c
··· 1100 1100 static inline int 1101 1101 ath5k_hw_to_driver_rix(struct ath5k_softc *sc, int hw_rix) 1102 1102 { 1103 - WARN_ON(hw_rix < 0 || hw_rix > AR5K_MAX_RATES); 1103 + WARN(hw_rix < 0 || hw_rix >= AR5K_MAX_RATES, 1104 + "hw_rix out of bounds: %x\n", hw_rix); 1104 1105 return sc->rate_idx[sc->curband->band][hw_rix]; 1105 1106 } 1106 1107