iwlwifi: mvm: rs: fix a theoretical access to uninitialized array elements
authorEyal Shapira <eyal@wizery.com>
Mon, 1 Feb 2016 07:07:05 +0000 (09:07 +0200)
committerEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Sat, 27 Feb 2016 19:59:54 +0000 (21:59 +0200)
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>
drivers/net/wireless/intel/iwlwifi/mvm/rs.c

index 6e7e78a378794a34174be26f2f9dcf01ba6403b3..3dc94d2e8a65ccf638670f9d37e1580b49af30af 100644 (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))
                rate_str = legacy_rates[rate->index];
        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_str = ht_vht_rates[rate->index];
        else