[bug report] wifi: mt76: mt7996: enable BSS_CHANGED_BASIC_RATES support

Dan Carpenter dan.carpenter at linaro.org
Wed May 3 08:08:28 PDT 2023


Hello Ryder Lee,

This is a semi-automatic email about new static checker warnings.

The patch 15ee62e73705: "wifi: mt76: mt7996: enable 
BSS_CHANGED_BASIC_RATES support" from Apr 14, 2023, leads to the 
following Smatch complaint:

    drivers/net/wireless/mediatek/mt76/mt7996/mac.c:1018 mt7996_mac_write_txwi()
    warn: variable dereferenced before check 'vif' (see line 1007)

drivers/net/wireless/mediatek/mt76/mt7996/mac.c
  1006		struct ieee80211_vif *vif = info->control.vif;
  1007		struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv;
                                                               ^^^^^^^^^^^^^
New dereference.

  1008		u8 band_idx = (info->hw_queue & MT_TX_HW_QUEUE_PHY) >> 2;
  1009		u8 p_fmt, q_idx, omac_idx = 0, wmm_idx = 0;
  1010		bool is_8023 = info->flags & IEEE80211_TX_CTL_HW_80211_ENCAP;
  1011		u16 tx_count = 15;
  1012		u32 val;
  1013		bool beacon = !!(changed & (BSS_CHANGED_BEACON |
  1014					    BSS_CHANGED_BEACON_ENABLED));
  1015		bool inband_disc = !!(changed & (BSS_CHANGED_UNSOL_BCAST_PROBE_RESP |
  1016						 BSS_CHANGED_FILS_DISCOVERY));
  1017	
  1018		if (vif) {
                    ^^^
Too late.

  1019			omac_idx = mvif->mt76.omac_idx;
  1020			wmm_idx = mvif->mt76.wmm_idx;

regards,
dan carpenter



More information about the Linux-mediatek mailing list