Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1403495
| From | "Coelho, Luciano" <luciano.coelho@intel.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 1/1] iwlwifi: rs: remove superfluous check |
| Date | 2016-05-19 10:30 +0200 |
| Message-ID | <rArvb-5HV-7@gated-at.bofh.it> (permalink) |
| References | <rzWKJ-2DG-5@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Wed, 2016-05-18 at 01:31 +0200, Heinrich Schuchardt wrote:
> If we dereference a variable anyway in other parts of the code,
> there is no need to check against NULL in a single place.
NACK. This is not true.
If lq_sta is NULL, it means that mvm_sta is also NULL. Then we call
the rate_control_send with mvm_sta == NULL:
if (rate_control_send_low(sta, mvm_sta, txrc))
return;
The rate_control_send_low() function looks like this:
bool rate_control_send_low(struct ieee80211_sta *pubsta,
void *priv_sta,
struct ieee80211_tx_rate_control *txrc)
{
[...]
if (!pubsta || !priv_sta || rc_no_data_or_no_ack_use_min(txrc)) {
[...]
return true;
}
[...]
}
Which means that if priv_sta (aka mvm_sta) is NULL, we will return
without running the rest of rs_get_rate() where lq_sta is accessed
without checks.
I admit that the rs_get_rate() function is a bit hard to read, but
removing the lq_sta check as you did doesn't help, but makes things
worse.
--
Cheers,
Luca.
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH 1/1] iwlwifi: rs: remove superfluous check Heinrich Schuchardt <xypron.glpk@gmx.de> - 2016-05-18 01:40 +0200 Re: [PATCH 1/1] iwlwifi: rs: remove superfluous check "Coelho, Luciano" <luciano.coelho@intel.com> - 2016-05-19 10:30 +0200
csiph-web