linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: eyal@wizery.com
Cc: Eyal Shapira <eyal@wizery.com>, linux-wireless@vger.kernel.org
Subject: re: iwlwifi: mvm: rs: refactor to allow direct rs updating
Date: Wed, 1 Oct 2014 17:55:53 +0300	[thread overview]
Message-ID: <20141001145553.GA32299@mwanda> (raw)

Hello Eyal Shapira,

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

The patch 1ebc8f2ef83d: "iwlwifi: mvm: rs: refactor to allow direct
rs updating" from Sep 14, 2014, leads to the following Smatch
complaint:

drivers/net/wireless/iwlwifi/mvm/rs.c:1228 iwl_mvm_rs_tx_status()
	 warn: variable dereferenced before check 'sta' (see line 1037)

drivers/net/wireless/iwlwifi/mvm/rs.c
  1036		u8 reduced_txp = (uintptr_t)info->status.status_driver_data[0];
  1037		struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta);
                                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Patch introduces a new unchecked "sta" dereference.

  1038		struct iwl_lq_sta *lq_sta = &mvmsta->lq_sta;
  1039	
  1040		/* Treat uninitialized rate scaling data same as non-existing. */
  1041		if (!lq_sta) {
  1042			IWL_DEBUG_RATE(mvm, "Station rate scaling not created yet.\n");
  1043			return;
  1044		} else if (!lq_sta->pers.drv) {
  1045			IWL_DEBUG_RATE(mvm, "Rate scaling not initialized yet.\n");
  1046			return;
  1047		}
  1048	

[ snip ]

  1223		/* The last TX rate is cached in lq_sta; it's set in if/else above */
  1224		lq_sta->last_rate_n_flags = ucode_rate;
  1225		IWL_DEBUG_RATE(mvm, "reduced txpower: %d\n", reduced_txp);
  1226	done:
  1227		/* See if there's a better rate or modulation mode to try. */
  1228		if (sta && sta->supp_rates[info->band])
                    ^^^
The existing code assumes "sta" can be NULL.

  1229			rs_rate_scale_perform(mvm, sta, lq_sta, tid);
  1230	}

regards,
dan carpenter

                 reply	other threads:[~2014-10-01 14:56 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20141001145553.GA32299@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=eyal@wizery.com \
    --cc=linux-wireless@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).