ath5k: validate mode in ath5k_ani_init() before trying to set it
authorPavel Roskin <proski@gnu.org>
Sat, 9 Jul 2011 04:17:45 +0000 (00:17 -0400)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 11 Jul 2011 19:02:15 +0000 (15:02 -0400)
Signed-off-by: Pavel Roskin <proski@gnu.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/ath/ath5k/ani.c

index a08f173..b88d10c 100644 (file)
@@ -630,6 +630,11 @@ ath5k_ani_init(struct ath5k_hw *ah, enum ath5k_ani_mode mode)
        if (ah->ah_version < AR5K_AR5212)
                return;
 
+       if (mode < ATH5K_ANI_MODE_OFF || mode > ATH5K_ANI_MODE_AUTO) {
+               ATH5K_ERR(ah->ah_sc, "ANI mode %d out of range", mode);
+               return;
+       }
+
        /* clear old state information */
        memset(&ah->ah_sc->ani_state, 0, sizeof(ah->ah_sc->ani_state));