Search Linux Wireless

re: iwlwifi: mvm: rs: refactor to allow direct rs updating

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux