All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Stern, Avraham" <avraham.stern@intel.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: "linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>,
	"Coelho, Luciano" <luciano.coelho@intel.com>
Subject: RE: [bug report] iwlwifi: mvm: toggle tx antenna if tx fails during connection establishment
Date: Wed, 10 Feb 2021 12:26:31 +0000	[thread overview]
Message-ID: <BN6PR11MB1539F4E287D03E2F23723B8CFF8D9@BN6PR11MB1539.namprd11.prod.outlook.com> (raw)
In-Reply-To: <YCO7gahK0ktH8YkY@mwanda>

Hi Dan,

The offending patch that caused the Smatch complaint is:
"iwlwifi: mvm: add explicit check for non-data frames in get Tx rate"

this patch adds an unconditional dereference of the  sta  parameter in iwl_mvm_get_tx_rate().
Before that, all the code paths check for the NULL option.

(this patch is from the recent days, that's why Smatch only complains now).

Regards,
Avi


-----Original Message-----
From: Dan Carpenter <dan.carpenter@oracle.com> 
Sent: Wednesday, February 10, 2021 12:55
To: Stern, Avraham <avraham.stern@intel.com>
Cc: linux-wireless@vger.kernel.org
Subject: [bug report] iwlwifi: mvm: toggle tx antenna if tx fails during connection establishment

[ Sorry, I don't know why Smatch is warning about a three year old bug
  and I'm not sure that it's blaming the correct commit but the warning
  looks correct.  - dan ]

Hello Avraham Stern,

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

The patch 0dde2440a77f: "iwlwifi: mvm: toggle tx antenna if tx fails during connection establishment" from Jul 11, 2018, leads to the following Smatch complaint:

    drivers/net/wireless/intel/iwlwifi/mvm/tx.c:356 iwl_mvm_set_tx_cmd_rate()
    error: we previously assumed 'sta' could be null (see line 341)

drivers/net/wireless/intel/iwlwifi/mvm/tx.c
   340	
   341		if (ieee80211_is_data(fc) && sta) {
                                             ^^^ This assumes that "sta" can be NULL.

   342			struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta);
   343	
   344			if (mvmsta->sta_state >= IEEE80211_STA_AUTHORIZED) {
   345				tx_cmd->initial_rate_index = 0;
   346				tx_cmd->tx_flags |= cpu_to_le32(TX_CMD_FLG_STA_RATE);
   347				return;
   348			}
   349		} else if (ieee80211_is_back_req(fc)) {
   350			tx_cmd->tx_flags |=
   351				cpu_to_le32(TX_CMD_FLG_ACK | TX_CMD_FLG_BAR);
   352		}
   353	
   354		/* Set the rate in the TX cmd */
   355		tx_cmd->rate_n_flags =
   356			cpu_to_le32(iwl_mvm_get_tx_rate_n_flags(mvm, info, sta, fc));
                                                                           ^^^ It is dereferenced unconsiditionally inside the function.

   357	}
   358	

See also:
drivers/net/wireless/intel/iwlwifi/mvm/tx.c:486 iwl_mvm_set_tx_params() error: we previously assumed 'sta' could be null (see line 482)

regards,
dan carpenter
---------------------------------------------------------------------
A member of the Intel Corporation group of companies

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.


      reply	other threads:[~2021-02-10 12:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-10 10:54 [bug report] iwlwifi: mvm: toggle tx antenna if tx fails during connection establishment Dan Carpenter
2021-02-10 12:26 ` Stern, Avraham [this message]

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=BN6PR11MB1539F4E287D03E2F23723B8CFF8D9@BN6PR11MB1539.namprd11.prod.outlook.com \
    --to=avraham.stern@intel.com \
    --cc=dan.carpenter@oracle.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=luciano.coelho@intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.