mac80211: off by one in mcs mask handling
"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>
diff --git a/net/mac80211/rate.c b/net/mac80211/rate.c
index 3fef26d..22fc28e 100644
--- a/net/mac80211/rate.c
+++ b/net/mac80211/rate.c
@@ -324,7 +324,7 @@
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. */
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index f1681e2..fe27476 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -5410,7 +5410,7 @@
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 */