From b3b2a9f60fd9e38c45d4728cac78ddf5596f3bb0 Mon Sep 17 00:00:00 2001 From: Bharath Vedartham Date: Wed, 22 May 2019 21:31:49 +0530 Subject: scsi: message: fusion: Use kmemdup instead of memcpy and kmalloc Replace kmalloc + memcpy with kmemdup. This was reported by coccinelle. Signed-off-by: Bharath Vedartham Signed-off-by: Martin K. Petersen --- drivers/message/fusion/mptbase.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/message/fusion/mptbase.c') diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c index d8882b0a1338..c2dd322691d1 100644 --- a/drivers/message/fusion/mptbase.c +++ b/drivers/message/fusion/mptbase.c @@ -6001,13 +6001,12 @@ mpt_findImVolumes(MPT_ADAPTER *ioc) if (mpt_config(ioc, &cfg) != 0) goto out; - mem = kmalloc(iocpage2sz, GFP_KERNEL); + mem = kmemdup(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); -- cgit v1.2.3