iwlwifi: mvm: correct rate_idx bounds-check
authorJohannes Berg <johannes.berg@intel.com>
Wed, 14 Sep 2016 08:20:10 +0000 (10:20 +0200)
committerLuca Coelho <luciano.coelho@intel.com>
Thu, 22 Sep 2016 20:28:22 +0000 (23:28 +0300)
The upper bound IWL_RATE_COUNT_LEGACY should be used
with a >= check, rejecting the value itself; fix that.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
drivers/net/wireless/intel/iwlwifi/mvm/tx.c

index e0c9065a3ad4e58a8fa1887db31d6dce56162ce0..ef4bdfc9e7e2d6b92b1b1c29c5880495de3a0032 100644 (file)
@@ -346,7 +346,7 @@ void iwl_mvm_set_tx_cmd_rate(struct iwl_mvm *mvm, struct iwl_tx_cmd *tx_cmd,
 
        rate_idx = info->control.rates[0].idx;
        /* if the rate isn't a well known legacy rate, take the lowest one */
-       if (rate_idx < 0 || rate_idx > IWL_RATE_COUNT_LEGACY)
+       if (rate_idx < 0 || rate_idx >= IWL_RATE_COUNT_LEGACY)
                rate_idx = rate_lowest_index(
                                &mvm->nvm_data->bands[info->band], sta);