From: Chen Ni <nichen@iscas.ac.cn>
To: gregory.greenman@intel.com, kvalo@kernel.org,
johannes.berg@intel.com, mukesh.sisodiya@intel.com
Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org,
Chen Ni <nichen@iscas.ac.cn>
Subject: [PATCH] wifi: iwlwifi: Add check for kmemdup
Date: Mon, 23 Oct 2023 06:45:01 +0000 [thread overview]
Message-ID: <20231023064501.274599-1-nichen@iscas.ac.cn> (raw)
Since the kmemdup may return NULL pointer,
it should be better to add check for the return value
in order to avoid NULL pointer dereference.
Fixes: 5e31b3df86ec ("wifi: iwlwifi: dbg: print pc register data once fw dump occurred")
Signed-off-by: Chen Ni <nichen@iscas.ac.cn>
---
drivers/net/wireless/intel/iwlwifi/iwl-drv.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c
index 3d87d26845e7..9bba8fa62f54 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c
@@ -1307,6 +1307,8 @@ static int iwl_parse_tlv_firmware(struct iwl_drv *drv,
tlv_len / sizeof(struct iwl_pc_data);
drv->trans->dbg.pc_data =
kmemdup(tlv_data, tlv_len, GFP_KERNEL);
+ if (!drv->trans->dbg.pc_data)
+ return -ENOMEM;
break;
default:
IWL_DEBUG_INFO(drv, "unknown TLV: %d\n", tlv_type);
--
2.25.1
next reply other threads:[~2023-10-23 6:45 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-23 6:45 Chen Ni [this message]
2023-10-23 9:08 ` Kalle Valo
2023-10-23 9:10 ` Johannes Berg
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=20231023064501.274599-1-nichen@iscas.ac.cn \
--to=nichen@iscas.ac.cn \
--cc=gregory.greenman@intel.com \
--cc=johannes.berg@intel.com \
--cc=kvalo@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=mukesh.sisodiya@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
all inboxes | Powered by JetHome®