Skip to content

Commit e548f74

Browse files
Dan Carpenterjmberg-intel
authored andcommitted
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: db3e1c4 ("mac80211: Import airtime calculation code from mt76") Reported-by: Toke Høiland-Jørgensen <toke@redhat.com> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Acked-by: Toke Høiland-Jørgensen <toke@redhat.com> Link: https://lore.kernel.org/r/20191126120910.ftr4t7me3by32aiz@kili.mountain Signed-off-by: Johannes Berg <johannes.berg@intel.com>
1 parent 56cb31e commit e548f74

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎net/mac80211/airtime.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@ u32 ieee80211_calc_rx_airtime(struct ieee80211_hw *hw,
442442
return 0;
443443

444444
sband = hw->wiphy->bands[status->band];
445-
if (!sband || status->rate_idx > sband->n_bitrates)
445+
if (!sband || status->rate_idx >= sband->n_bitrates)
446446
return 0;
447447

448448
rate = &sband->bitrates[status->rate_idx];

0 commit comments

Comments
 (0)