ath9k: index out of bounds
authorroel <roel.kluin@gmail.com>
Sun, 10 Apr 2011 19:09:55 +0000 (21:09 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Tue, 12 Apr 2011 20:59:32 +0000 (16:59 -0400)
Check whether index is within bounds before testing the element

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/ath/ath9k/rc.c

index a3241cd089b1db84cf60e2d92961dd6426ed9eb7..2a40532126f35c428a990f1cb08b9bb7ce6fda96 100644 (file)
@@ -1092,8 +1092,7 @@ static int ath_rc_get_rateindex(const struct ath_rate_table *rate_table,
        if (!(rate->flags & IEEE80211_TX_RC_MCS))
                return rate->idx;
 
-       while (rate->idx > mcs_rix_off[i] &&
-              i < ARRAY_SIZE(mcs_rix_off)) {
+       while (i < ARRAY_SIZE(mcs_rix_off) && rate->idx > mcs_rix_off[i]) {
                rix++; i++;
        }