From: Luca Coelho <luca@coelho.fi>
To: kvalo@codeaurora.org
Cc: linux-wireless@vger.kernel.org,
Shahar S Matityahu <shahar.s.matityahu@intel.com>,
Luca Coelho <luciano.coelho@intel.com>
Subject: [PATCH 4/7] iwlwifi: dbg_ini: fix bad dump size calculation
Date: Fri, 8 Mar 2019 12:08:45 +0200 [thread overview]
Message-ID: <20190308100848.13188-5-luca@coelho.fi> (raw)
In-Reply-To: <20190308100848.13188-1-luca@coelho.fi>
From: Shahar S Matityahu <shahar.s.matityahu@intel.com>
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>
---
drivers/net/wireless/intel/iwlwifi/fw/dbg.c | 6 +++---
1 file 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;
--
2.20.1
next prev parent reply other threads:[~2019-03-08 10:09 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-08 10:08 [PATCH 0/7] iwlwifi: fixes intended for 5.1 2019-03-08 Luca Coelho
2019-03-08 10:08 ` [PATCH 1/7] iwlwifi: mvm: fix TX crypto on 22560+ devices Luca Coelho
2019-03-08 10:08 ` [PATCH 2/7] iwlwifi: add sync_nmi to trans ops Luca Coelho
2019-03-08 10:08 ` [PATCH 3/7] iwlwifi: dbg_ini: in case of region dump failure set memory to 0 Luca Coelho
2019-03-08 10:08 ` Luca Coelho [this message]
2019-03-08 10:08 ` [PATCH 5/7] iwlwifi: use sync nmi in case of init flow failure Luca Coelho
2019-03-08 10:08 ` [PATCH 6/7] iwlwifi: rename structs to fit the new names Luca Coelho
2019-03-08 10:08 ` [PATCH 7/7] iwlwifi: add new 0x2723/0x2080 card for 22000 Luca Coelho
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190308100848.13188-5-luca@coelho.fi \
--to=luca@coelho.fi \
--cc=kvalo@codeaurora.org \
--cc=linux-wireless@vger.kernel.org \
--cc=luciano.coelho@intel.com \
--cc=shahar.s.matityahu@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox