Skip to contentSkip to conversation

iwlwifi: mvm: fix off by one in iwl_mvm_stat_iterator_all_macs()

PATCH New Dan Carpenter 1 participant 1 message Jan 6, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iwlwifi: mvm: fix off by one in iwl_mvm_stat_iterator_all_macs()

Change the comparison from ">" to ">=" to avoid accessing one element beyond the end of the ->per_mac_stats[] array.

Fixes 6324c173ff4a ("iwlwifi: mvm: add support for statistics update version 15")
---
 drivers/net/wireless/intel/iwlwifi/mvm/rx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/intel/iwlwifi/mvm/rx.c +1 -1
index 64446a11ef98..9a46468bd434 100644
@@ -640,7 +640,7 @@ static void iwl_mvm_stat_iterator_all_macs(void *_data, u8 *mac,
 	struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
 	u16 vif_id = mvmvif->id;
 
-	if (WARN_ONCE(vif_id > MAC_INDEX_AUX, "invalid vif id: %d", vif_id))
+	if (WARN_ONCE(vif_id >= MAC_INDEX_AUX, "invalid vif id: %d", vif_id))
 		return;
 
 	if (vif->type != NL80211_IFTYPE_STATION)
Signature · 1 line
2.20.1