Subject: Coverity: mt7996_mcu_rx_radar_detected(): Insecure data handling

From: coverity-bot <[email-masked]>
Date: Fri, 2 Dec 2022 14:13:02 -0800

Hello!

This is an experimental semi-automated report about issues detected by
Coverity from a scan of next-20221202 as part of the linux-next scan project:
https://scan.coverity.com/projects/linux-next-weekly-scan

You're getting this email because you were associated with the identified
lines of code (noted below) that were touched by commits:

  Thu Dec 1 17:29:14 2022 +0100
    98686cd21624 ("wifi: mt76: mt7996: add driver for MediaTek Wi-Fi 7 (802.11be) devices")

Coverity reported the following:

*** CID 1527812:  Insecure data handling  (TAINTED_SCALAR)
drivers/net/wireless/mediatek/mt76/mt7996/mcu.c:338 in mt7996_mcu_rx_radar_detected()
332     {
333     	struct mt76_phy *mphy = &dev->mt76.phy;
334     	struct mt7996_mcu_rdd_report *r;
335
336     	r = (struct mt7996_mcu_rdd_report *)skb->data;
337
vvv     CID 1527812:  Insecure data handling  (TAINTED_SCALAR)
vvv     Using tainted variable "r->band_idx" as an index into an array "(*dev).mt76.phys".
338     	mphy = dev->mt76.phys[r->band_idx];
339     	if (!mphy)
340     		return;
341
342     	if (r->band_idx == MT_RX_SEL2)
343     		cfg80211_background_radar_event(mphy->hw->wiphy,

If this is a false positive, please let us know so we can mark it as
such, or teach the Coverity rules to be smarter. If not, please make
sure fixes get into linux-next. :) For patches fixing this, please
include these lines (but double-check the "Fixes" first):

Reported-by: coverity-bot <[email-masked]>
Addresses-Coverity-ID: 1527812 ("Insecure data handling")
Fixes: 98686cd21624 ("wifi: mt76: mt7996: add driver for MediaTek Wi-Fi 7 (802.11be) devices")

Thanks for your attention!

-- 
Coverity-bot