[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20211003083144.217955-1-songkai01@inspur.com>
Date: Sun, 3 Oct 2021 16:31:44 +0800
From: Kai Song <songkai01@...pur.com>
To: <luciano.coelho@...el.com>, <kvalo@...eaurora.org>
CC: <linux-wireless@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
Kai Song <songkai01@...pur.com>
Subject: [PATCH] iwlwifi: mvm: Use kmemdup() instead of kzalloc and memcpy
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@...pur.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
Powered by blists - more mailing lists