]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
iwlwifi: mvm: handle possible BIOS bug
authorSharon Dvir <sharon.dvir@intel.com>
Tue, 21 Feb 2017 09:12:12 +0000 (11:12 +0200)
committerLuca Coelho <luciano.coelho@intel.com>
Tue, 25 Apr 2017 12:28:41 +0000 (15:28 +0300)
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>
drivers/net/wireless/intel/iwlwifi/mvm/fw.c

index b5c7dffafdc1a4ae1ac040f8394a526e2a9d9925..e6c9528eeedac795ddf41e330470969ec2ecd142 100644 (file)
@@ -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;