* [PATCH] wifi: iwlwifi: Add check for kmemdup
@ 2023-10-23 6:45 Chen Ni
2023-10-23 9:08 ` Kalle Valo
0 siblings, 1 reply; 3+ messages in thread
From: Chen Ni @ 2023-10-23 6:45 UTC (permalink / raw)
To: gregory.greenman, kvalo, johannes.berg, mukesh.sisodiya
Cc: linux-wireless, linux-kernel, Chen Ni
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
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] wifi: iwlwifi: Add check for kmemdup
2023-10-23 6:45 [PATCH] wifi: iwlwifi: Add check for kmemdup Chen Ni
@ 2023-10-23 9:08 ` Kalle Valo
2023-10-23 9:10 ` Johannes Berg
0 siblings, 1 reply; 3+ messages in thread
From: Kalle Valo @ 2023-10-23 9:08 UTC (permalink / raw)
To: Chen Ni
Cc: gregory.greenman, johannes.berg, mukesh.sisodiya, linux-wireless,
linux-kernel
Chen Ni <nichen@iscas.ac.cn> writes:
> 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")
The fixes tag should be in one line.
--
https://patchwork.kernel.org/project/linux-wireless/list/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] wifi: iwlwifi: Add check for kmemdup
2023-10-23 9:08 ` Kalle Valo
@ 2023-10-23 9:10 ` Johannes Berg
0 siblings, 0 replies; 3+ messages in thread
From: Johannes Berg @ 2023-10-23 9:10 UTC (permalink / raw)
To: Kalle Valo, Chen Ni
Cc: gregory.greenman, mukesh.sisodiya, linux-wireless, linux-kernel
On Mon, 2023-10-23 at 12:08 +0300, Kalle Valo wrote:
> Chen Ni <nichen@iscas.ac.cn> writes:
>
> > 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")
>
> The fixes tag should be in one line.
>
It's also irrelevant because (a) the fix is incorrect, and (b) we
already have a (correct) fix :)
johannes
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-10-23 9:10 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-23 6:45 [PATCH] wifi: iwlwifi: Add check for kmemdup Chen Ni
2023-10-23 9:08 ` Kalle Valo
2023-10-23 9:10 ` Johannes Berg
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®