summaryrefslogtreecommitdiff
path: root/drivers/message/fusion
diff options
context:
space:
mode:
authorBharath Vedartham <linux.bhar@gmail.com>2019-05-22 19:01:49 +0300
committerMartin K. Petersen <martin.petersen@oracle.com>2019-06-19 02:46:24 +0300
commitb3b2a9f60fd9e38c45d4728cac78ddf5596f3bb0 (patch)
treeadd33bc1cffc8305ac888fc5dc5583f4386a2fa9 /drivers/message/fusion
parentde19212c2890d1bb1e2d0e303affba620b86819b (diff)
downloadlinux-b3b2a9f60fd9e38c45d4728cac78ddf5596f3bb0.tar.xz
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 <linux.bhar@gmail.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/message/fusion')
-rw-r--r--drivers/message/fusion/mptbase.c3
1 files changed, 1 insertions, 2 deletions
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);