From: Bharath Vedartham Date: Wed, 22 May 2019 16:01:49 +0000 (+0530) Subject: scsi: message: fusion: Use kmemdup instead of memcpy and kmalloc X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=b3b2a9f60fd9e38c45d4728cac78ddf5596f3bb0;p=openwrt%2Fstaging%2Fblogic.git 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 --- 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);