DORMANTno replies

[PATCH linux-next] net: wwan: iosm: use kmemdup instead of kzalloc and memcpy

From: <hidden>
Date: 2021-09-17 09:43:38
Also in: lkml
Subsystem: intel wwan iosm driver, networking drivers, the rest, wwan drivers · Maintainers: Andrew Lunn, "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Linus Torvalds, Loic Poulain, Sergey Ryazanov

From: Changcheng Deng <redacted>

Fixes coccicheck warning: WARNING opportunity for kmemdup
in "./drivers/net/wwan/iosm/iosm_ipc_flash.c"

Reported-by: Zeal Robot <redacted>
Signed-off-by: Changcheng Deng <redacted>
---
 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help