Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Bharath Vedartham and committed by
Martin K. Petersen
b3b2a9f6 de19212c

+1 -2
+1 -2
drivers/message/fusion/mptbase.c
··· 6001 6001 if (mpt_config(ioc, &cfg) != 0) 6002 6002 goto out; 6003 6003 6004 - mem = kmalloc(iocpage2sz, GFP_KERNEL); 6004 + mem = kmemdup(pIoc2, iocpage2sz, GFP_KERNEL); 6005 6005 if (!mem) { 6006 6006 rc = -ENOMEM; 6007 6007 goto out; 6008 6008 } 6009 6009 6010 - memcpy(mem, (u8 *)pIoc2, iocpage2sz); 6011 6010 ioc->raid_data.pIocPg2 = (IOCPage2_t *) mem; 6012 6011 6013 6012 mpt_read_ioc_pg_3(ioc);