iwlwifi: mvm: rs: fix a theoretical access to uninitialized array elements

Klocwork is unhappy as ht_vht_rates might be accessed with
rate->index being set to values between 0 and 3 which will
lead to accessing uninitialized array elements. Effectively this
doesn't happen as in HT/VHT we're not using these rate indices.
Still fix this.

Signed-off-by: Eyal Shapira <eyalx.shapira@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
This commit is contained in:
Eyal Shapira 2016-02-01 09:07:05 +02:00 committed by Emmanuel Grumbach
parent a339e918da
commit 4494541c0c

View File

@ -556,6 +556,7 @@ static char *rs_pretty_rate(const struct rs_rate *rate)
if (is_type_legacy(rate->type) && (rate->index <= IWL_RATE_54M_INDEX)) if (is_type_legacy(rate->type) && (rate->index <= IWL_RATE_54M_INDEX))
rate_str = legacy_rates[rate->index]; rate_str = legacy_rates[rate->index];
else if ((is_type_ht(rate->type) || is_type_vht(rate->type)) && else if ((is_type_ht(rate->type) || is_type_vht(rate->type)) &&
(rate->index >= IWL_RATE_MCS_0_INDEX) &&
(rate->index <= IWL_RATE_MCS_9_INDEX)) (rate->index <= IWL_RATE_MCS_9_INDEX))
rate_str = ht_vht_rates[rate->index]; rate_str = ht_vht_rates[rate->index];
else else