[bug report] wifi: mt76: connac: rework connac helpers

Dan Carpenter dan.carpenter at linaro.org
Mon Jan 20 01:20:26 PST 2025


Hello Shayne Chen,

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

Commit a0facfc80ec1 ("wifi: mt76: connac: rework connac helpers")
from Jan 2, 2025, leads to the following Smatch complaint:

    drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c:307 mt76_connac2_mac_tx_rate_val()
    warn: variable dereferenced before check 'conf' (see line 300)

drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c
   299	{
   300		struct mt76_vif_link *mvif = mt76_vif_conf_link(mphy->dev, conf->vif, conf);
                                                                           ^^^^^^^^^
The patch adds a dereference

   301		struct cfg80211_chan_def *chandef = mvif->ctx ?
   302						    &mvif->ctx->def : &mphy->chandef;
   303		u8 nss = 0, mode = 0, band = chandef->chan->band;
   304		int rateidx = 0, mcast_rate;
   305		int offset = 0;
   306	
   307		if (!conf)
                    ^^^^^
The existing code assumes "conf" can be NULL

   308			goto legacy;
   309	

regards,
dan carpenter



More information about the Linux-mediatek mailing list