mt76: Off by one in mt76_calc_rx_airtime()
authorDan Carpenter <dan.carpenter@oracle.com>
Tue, 26 Nov 2019 04:49:56 +0000 (07:49 +0300)
committerKalle Valo <kvalo@codeaurora.org>
Wed, 18 Dec 2019 18:50:40 +0000 (20:50 +0200)
commitb43e36d75e8727f78892652a25967a1ffa03d1d1
treefa6b500d5af2002b8b61417cd20fb4fc31ccf9e9
parentd68f4e43a46ff1f772ff73085f96d44eb4163e9d
mt76: Off by one in mt76_calc_rx_airtime()

The sband->bitrates[] array has "sband->n_bitrates" elements so this
check needs to be >= instead of > or we could read beyond the end of the
array.

These values come from when we call mt76_register_device():

ret = mt76_register_device(&dev->mt76, true, mt7603_rates,
   ARRAY_SIZE(mt7603_rates));

Here sband->bitrates[] is mt7603_rates[] and ->n_bitrates is the
ARRAY_SIZE()

Fixes: 5ce09c1a7907 ("mt76: track rx airtime for airtime fairness and survey")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/mediatek/mt76/airtime.c