Commit e548f749 authored by Dan Carpenter's avatar Dan Carpenter Committed by Johannes Berg

mac80211: airtime: Fix an off by one in ieee80211_calc_rx_airtime()

This code was copied from mt76 and inherited an off by one bug from
there.  The > should be >= so that we don't read one element beyond
the end of the array.

Fixes: db3e1c40 ("mac80211: Import airtime calculation code from mt76")
Reported-by: default avatarToke Høiland-Jørgensen <toke@redhat.com>
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Acked-by: default avatarToke Høiland-Jørgensen <toke@redhat.com>
Link: https://lore.kernel.org/r/20191126120910.ftr4t7me3by32aiz@kili.mountainSigned-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 56cb31e1
...@@ -442,7 +442,7 @@ u32 ieee80211_calc_rx_airtime(struct ieee80211_hw *hw, ...@@ -442,7 +442,7 @@ u32 ieee80211_calc_rx_airtime(struct ieee80211_hw *hw,
return 0; return 0;
sband = hw->wiphy->bands[status->band]; sband = hw->wiphy->bands[status->band];
if (!sband || status->rate_idx > sband->n_bitrates) if (!sband || status->rate_idx >= sband->n_bitrates)
return 0; return 0;
rate = &sband->bitrates[status->rate_idx]; rate = &sband->bitrates[status->rate_idx];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment