瀏覽代碼

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>
Sharon Dvir 8 年之前
父節點
當前提交
e2ef147686
共有 1 個文件被更改,包括 6 次插入0 次删除
  1. 6 0
      drivers/net/wireless/intel/iwlwifi/mvm/fw.c

+ 6 - 0
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;