Linux-mediatek Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@linaro.org>
To: Shayne Chen <shayne.chen@mediatek.com>
Cc: Shayne Chen <shayne.chen@mediatek.com>,
	linux-mediatek@lists.infradead.org
Subject: [bug report] wifi: mt76: connac: rework connac helpers
Date: Mon, 20 Jan 2025 12:20:26 +0300	[thread overview]
Message-ID: <33242ead-4f91-40c7-908a-6bfb87977611@stanley.mountain> (raw)

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


             reply	other threads:[~2025-01-20  9:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-20  9:20 Dan Carpenter [this message]
  -- strict thread matches above, loose matches on Subject: below --
2025-01-20  9:26 [bug report] wifi: mt76: connac: rework connac helpers Dan Carpenter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=33242ead-4f91-40c7-908a-6bfb87977611@stanley.mountain \
    --to=dan.carpenter@linaro.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=shayne.chen@mediatek.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox