diff mbox series

[-next] scsi: mptfusion: Use kmemdup rather than duplicating its implementation in mpt_remove_dead_ioc_func

Message ID 1536892438-129520-1-git-send-email-yuehaibing@huawei.com (mailing list archive)
State Deferred
Headers show
Series [-next] scsi: mptfusion: Use kmemdup rather than duplicating its implementation in mpt_remove_dead_ioc_func | expand

Commit Message

Yue Haibing Sept. 14, 2018, 2:33 a.m. UTC
Use kmemdup rather than duplicating its implementation

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
 drivers/message/fusion/mptbase.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c
index dc1e43a..a32d3d0 100644
--- a/drivers/message/fusion/mptbase.c
+++ b/drivers/message/fusion/mptbase.c
@@ -6001,13 +6001,12 @@  static int mpt_remove_dead_ioc_func(void *arg)
 	if (mpt_config(ioc, &cfg) != 0)
 		goto out;
 
-	mem = kmalloc(iocpage2sz, GFP_KERNEL);
+	mem = kmemdup((u8 *)pIoc2, iocpage2sz, GFP_KERNEL);
 	if (!mem) {
 		rc = -ENOMEM;
 		goto out;
 	}
 
-	memcpy(mem, (u8 *)pIoc2, iocpage2sz);
 	ioc->raid_data.pIocPg2 = (IOCPage2_t *) mem;
 
 	mpt_read_ioc_pg_3(ioc);