Commit b3b2a9f6 authored by Bharath Vedartham's avatar Bharath Vedartham Committed by Martin K. Petersen

scsi: message: fusion: Use kmemdup instead of memcpy and kmalloc

Replace kmalloc + memcpy with kmemdup.

This was reported by coccinelle.
Signed-off-by: default avatarBharath Vedartham <linux.bhar@gmail.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent de19212c
...@@ -6001,13 +6001,12 @@ mpt_findImVolumes(MPT_ADAPTER *ioc) ...@@ -6001,13 +6001,12 @@ mpt_findImVolumes(MPT_ADAPTER *ioc)
if (mpt_config(ioc, &cfg) != 0) if (mpt_config(ioc, &cfg) != 0)
goto out; goto out;
mem = kmalloc(iocpage2sz, GFP_KERNEL); mem = kmemdup(pIoc2, iocpage2sz, GFP_KERNEL);
if (!mem) { if (!mem) {
rc = -ENOMEM; rc = -ENOMEM;
goto out; goto out;
} }
memcpy(mem, (u8 *)pIoc2, iocpage2sz);
ioc->raid_data.pIocPg2 = (IOCPage2_t *) mem; ioc->raid_data.pIocPg2 = (IOCPage2_t *) mem;
mpt_read_ioc_pg_3(ioc); mpt_read_ioc_pg_3(ioc);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment