summaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless
diff options
context:
space:
mode:
authorShahar S Matityahu2019-02-12 08:56:49 +0100
committerLuca Coelho2019-03-22 11:49:04 +0100
commitb05d57c9b647b77edf9ac4550c493cf77c3923c7 (patch)
treee78db2e4fc27bbdcc0f13fbe16261cbd93265906 /drivers/net/wireless
parentiwlwifi: dbg_ini: in case of region dump failure set memory to 0 (diff)
downloadkernel-qcow2-linux-b05d57c9b647b77edf9ac4550c493cf77c3923c7.tar.gz
kernel-qcow2-linux-b05d57c9b647b77edf9ac4550c493cf77c3923c7.tar.xz
kernel-qcow2-linux-b05d57c9b647b77edf9ac4550c493cf77c3923c7.zip
iwlwifi: dbg_ini: fix bad dump size calculation
The driver initiates the size value with the size of the struct and then adds the size of the data and checks if the size is zero so size can not be equal to zero. Solve this by getting the data size, check that it is not equal to zero and only then add the struct size. Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com> Fixes: 7a14c23dcdee ("iwlwifi: dbg: dump data according to the new ini TLVs") Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r--drivers/net/wireless/intel/iwlwifi/fw/dbg.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/net/wireless/intel/iwlwifi/fw/dbg.c b/drivers/net/wireless/intel/iwlwifi/fw/dbg.c
index da5d9d79c372..b99d38b37014 100644
--- a/drivers/net/wireless/intel/iwlwifi/fw/dbg.c
+++ b/drivers/net/wireless/intel/iwlwifi/fw/dbg.c
@@ -1809,12 +1809,12 @@ _iwl_fw_error_ini_dump(struct iwl_fw_runtime *fwrt,
trigger = fwrt->dump.active_trigs[id].trig;
- size = sizeof(*dump_file);
- size += iwl_fw_ini_get_trigger_len(fwrt, trigger);
-
+ size = iwl_fw_ini_get_trigger_len(fwrt, trigger);
if (!size)
return NULL;
+ size += sizeof(*dump_file);
+
dump_file = vzalloc(size);
if (!dump_file)
return NULL;