[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20210917094241.232168-1-deng.changcheng@zte.com.cn>
Date: Fri, 17 Sep 2021 09:42:41 +0000
From: cgel.zte@...il.com
To: m.chetan.kumar@...el.com
Cc: linuxwwan@...el.com, loic.poulain@...aro.org,
ryazanov.s.a@...il.com, johannes@...solutions.net,
davem@...emloft.net, kuba@...nel.org, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org,
Changcheng Deng <deng.changcheng@....com.cn>,
Zeal Robot <zealci@....com.cn>
Subject: [PATCH linux-next] net: wwan: iosm: use kmemdup instead of kzalloc and memcpy
From: Changcheng Deng <deng.changcheng@....com.cn>
Fixes coccicheck warning: WARNING opportunity for kmemdup
in "./drivers/net/wwan/iosm/iosm_ipc_flash.c"
Reported-by: Zeal Robot <zealci@....com.cn>
Signed-off-by: Changcheng Deng <deng.changcheng@....com.cn>
---
drivers/net/wwan/iosm/iosm_ipc_flash.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/net/wwan/iosm/iosm_ipc_flash.c b/drivers/net/wwan/iosm/iosm_ipc_flash.c
index a43aafc70168..3d2f1ec6da00 100644
--- a/drivers/net/wwan/iosm/iosm_ipc_flash.c
+++ b/drivers/net/wwan/iosm/iosm_ipc_flash.c
@@ -430,11 +430,10 @@ int ipc_flash_boot_psi(struct iosm_devlink *ipc_devlink,
int ret;
dev_dbg(ipc_devlink->dev, "Boot transfer PSI");
- psi_code = kzalloc(fw->size, GFP_KERNEL);
+ psi_code = kmemdup(fw->data, fw->size, GFP_KERNEL);
if (!psi_code)
return -ENOMEM;
- memcpy(psi_code, fw->data, fw->size);
ret = ipc_imem_sys_devlink_write(ipc_devlink, psi_code, fw->size);
if (ret) {
dev_err(ipc_devlink->dev, "RPSI Image write failed");
--
2.25.1
Powered by blists - more mailing lists