All of lore.kernel.org
 help / color / mirror / Atom feed
* re: iwlwifi: mvm: rs: refactor to allow direct rs updating
@ 2014-10-01 14:55 Dan Carpenter
  0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2014-10-01 14:55 UTC (permalink / raw)
  To: eyal; +Cc: Eyal Shapira, linux-wireless

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2014-10-01 14:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-01 14:55 iwlwifi: mvm: rs: refactor to allow direct rs updating Dan Carpenter

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.