diff options
author | Sharon Dvir <sharon.dvir@intel.com> | 2017-02-21 11:12:12 +0200 |
---|---|---|
committer | Luca Coelho <luciano.coelho@intel.com> | 2017-04-25 15:28:41 +0300 |
commit | e2ef147686751f1a08143bb7b3bda629cceb9369 (patch) | |
tree | 035e8a85fdd990bd6c4e26ee5cf4d1c60536954a | |
parent | 3287bb1088d5470b2057ad3fefb9f3dae586515f (diff) | |
download | linux-stable-e2ef147686751f1a08143bb7b3bda629cceb9369.tar.gz linux-stable-e2ef147686751f1a08143bb7b3bda629cceb9369.tar.bz2 linux-stable-e2ef147686751f1a08143bb7b3bda629cceb9369.zip |
iwlwifi: mvm: handle possible BIOS bug
In iwl_mvm_sar_get_ewrd_table() In case of a BIOS bug, n_profiles
might be 0 thus we need to return an error value. Found by Klocwork.
Signed-off-by: Sharon Dvir <sharon.dvir@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
-rw-r--r-- | drivers/net/wireless/intel/iwlwifi/mvm/fw.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c index b5c7dffafdc1..e6c9528eeeda 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/fw.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/fw.c @@ -1201,6 +1201,12 @@ static int iwl_mvm_sar_get_ewrd_table(struct iwl_mvm *mvm) enabled = !!(wifi_pkg->package.elements[1].integer.value); n_profiles = wifi_pkg->package.elements[2].integer.value; + /* in case of BIOS bug */ + if (n_profiles <= 0) { + ret = -EINVAL; + goto out_free; + } + for (i = 0; i < n_profiles; i++) { /* the tables start at element 3 */ static int pos = 3; |