mac80211: off by one in mcs mask handling
authorDan Carpenter <dan.carpenter@oracle.com>
Wed, 1 Feb 2012 07:42:11 +0000 (10:42 +0300)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 6 Feb 2012 19:55:41 +0000 (14:55 -0500)
"ridx" is used as an index into the mcs_mask[] array which has
IEEE80211_HT_MCS_MASK_LEN elements.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
net/mac80211/rate.c
net/wireless/nl80211.c

index 3fef26d8898abd3953e8c0b3fcddfba87436bca2..22fc28e9026e59d2c9fe6994779313b279dce252 100644 (file)
@@ -324,7 +324,7 @@ static bool rate_idx_match_mcs_mask(struct ieee80211_tx_rate *rate,
        rbit = rate->idx % 8;
 
        /* sanity check */
-       if (ridx < 0 || ridx > IEEE80211_HT_MCS_MASK_LEN)
+       if (ridx < 0 || ridx >= IEEE80211_HT_MCS_MASK_LEN)
                return false;
 
        /* See whether the selected rate or anything below it is allowed. */
index f1681e2c5949dc0bb6cde87b9c4474bc8c2a6dae..fe2747653564b6e63133f057cd9d9ec2712c900e 100644 (file)
@@ -5410,7 +5410,7 @@ static bool ht_rateset_to_mask(struct ieee80211_supported_band *sband,
                rbit = BIT(rates[i] % 8);
 
                /* check validity */
-               if ((ridx < 0) || (ridx > IEEE80211_HT_MCS_MASK_LEN))
+               if ((ridx < 0) || (ridx >= IEEE80211_HT_MCS_MASK_LEN))
                        return false;
 
                /* check availability */