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

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
Loading
Loading
Loading
Loading
+1 −2
Original line number Original line Diff line number Diff line
@@ -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);