[bug report] wifi: mt76: mt7925: add mt7925_change_vif_links

Dan Carpenter dan.carpenter at linaro.org
Fri Jul 12 08:32:40 PDT 2024


Hello Sean Wang,

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

Commit 69acd6d910b0 ("wifi: mt76: mt7925: add
mt7925_change_vif_links") from Jul 6, 2024, leads to the following
Smatch complaint:

    drivers/net/wireless/mediatek/mt76/mt7925/mcu.c:1155 mt7925_mcu_set_mlo_roc()
    warn: variable dereferenced before check 'mconf' (see line 1127)

drivers/net/wireless/mediatek/mt76/mt7925/mcu.c
  1126	{
  1127		struct mt792x_vif *mvif = mconf->vif;
                                          ^^^^^^^^^^
Dereference

  1128		struct ieee80211_vif *vif = container_of((void *)mvif,
  1129							 struct ieee80211_vif, drv_priv);
  1130		struct ieee80211_bss_conf *link_conf;
  1131		struct ieee80211_channel *chan;
  1132		const u8 ch_band[] = {
  1133			[NL80211_BAND_2GHZ] = 1,
  1134			[NL80211_BAND_5GHZ] = 2,
  1135			[NL80211_BAND_6GHZ] = 3,
  1136		};
  1137		enum mt7925_roc_req type;
  1138		int center_ch, i = 0;
  1139		bool is_AG_band = false;
  1140		struct {
  1141			u8 id;
  1142			u8 bss_idx;
  1143			u16 tag;
  1144			struct mt792x_bss_conf *mconf;
  1145			struct ieee80211_channel *chan;
  1146		} links[2];
  1147	
  1148		struct {
  1149			struct {
  1150				u8 rsv[4];
  1151			} __packed hdr;
  1152			struct roc_acquire_tlv roc[2];
  1153		} __packed req;
  1154	
  1155		if (!mconf || hweight16(vif->valid_links) < 2 ||
                     ^^^^^
Checked too late

  1156		    hweight16(sel_links) != 2)
  1157			return -EPERM;

regards,
dan carpenter



More information about the Linux-mediatek mailing list