* [PATCH] iwlwifi: mvm: Use kmemdup() instead of kzalloc and memcpy
@ 2021-10-03 8:31 Kai Song
0 siblings, 0 replies; 2+ messages in thread
From: Kai Song @ 2021-10-03 8:31 UTC (permalink / raw)
To: luciano.coelho, kvalo; +Cc: linux-wireless, linux-kernel, Kai Song
fix memdup.cocci warning:
drivers/net/wireless/intel/iwlwifi/mvm/rfi.c:110:8-15: WARNING opportunity for kmemdup
Signed-off-by: Kai Song <songkai01@inspur.com>
---
drivers/net/wireless/intel/iwlwifi/mvm/rfi.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rfi.c b/drivers/net/wireless/intel/iwlwifi/mvm/rfi.c
index 44344216a1a9..1954b4cdb90b 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/rfi.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/rfi.c
@@ -107,12 +107,10 @@ struct iwl_rfi_freq_table_resp_cmd *iwl_rfi_get_freq_table(struct iwl_mvm *mvm)
if (WARN_ON_ONCE(iwl_rx_packet_payload_len(cmd.resp_pkt) != resp_size))
return ERR_PTR(-EIO);
- resp = kzalloc(resp_size, GFP_KERNEL);
+ resp = kmemdup(cmd.resp_pkt->data, resp_size, GFP_KERNEL);
if (!resp)
return ERR_PTR(-ENOMEM);
- memcpy(resp, cmd.resp_pkt->data, resp_size);
-
iwl_free_resp(&cmd);
return resp;
}
--
2.27.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH] iwlwifi: mvm: Use kmemdup instead of kzalloc and memcpy
@ 2021-03-05 14:29 angkery
0 siblings, 0 replies; 2+ messages in thread
From: angkery @ 2021-03-05 14:29 UTC (permalink / raw)
To: luciano.coelho, kvalo, davem, kuba, gregory.greenman
Cc: linux-wireless, netdev, linux-kernel, Junlin Yang
From: Junlin Yang <yangjunlin@yulong.com>
Fixes coccicheck warnings:
./drivers/net/wireless/intel/iwlwifi/mvm/rfi.c:110:8-15:
WARNING opportunity for kmemdup
Signed-off-by: Junlin Yang <yangjunlin@yulong.com>
---
drivers/net/wireless/intel/iwlwifi/mvm/rfi.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rfi.c b/drivers/net/wireless/intel/iwlwifi/mvm/rfi.c
index 8739190..f665045 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/rfi.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/rfi.c
@@ -107,12 +107,10 @@ struct iwl_rfi_freq_table_resp_cmd *iwl_rfi_get_freq_table(struct iwl_mvm *mvm)
if (WARN_ON_ONCE(iwl_rx_packet_payload_len(cmd.resp_pkt) != resp_size))
return ERR_PTR(-EIO);
- resp = kzalloc(resp_size, GFP_KERNEL);
+ resp = kmemdup(cmd.resp_pkt->data, resp_size, GFP_KERNEL);
if (!resp)
return ERR_PTR(-ENOMEM);
- memcpy(resp, cmd.resp_pkt->data, resp_size);
-
iwl_free_resp(&cmd);
return resp;
}
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-10-03 8:38 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-03 8:31 [PATCH] iwlwifi: mvm: Use kmemdup() instead of kzalloc and memcpy Kai Song
-- strict thread matches above, loose matches on Subject: below --
2021-03-05 14:29 [PATCH] iwlwifi: mvm: Use kmemdup " angkery
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).