scsi: message: fusion: Use kmemdup instead of duplicating its function
Subsystems (2)
PATCH 1/1 scsi: message: fusion: Use kmemdup instead of duplicating its function
kmemdup has implemented the function that kmalloc() + memcpy(). We prefer to kmemdup rather than code opened implementation.
This issue was detected with the help of coccinelle.
Signed-off-by Wen Yang <[email protected]>
CC Sathya Prakash <[email protected]>
CC Chaitra P B <[email protected]>
CC Suganath Prabu Subramani <[email protected]>
--- drivers/message/fusion/mptbase.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/message/fusion/mptbase.c +1 -2
@@ -6001,13 +6001,12 @@ mpt_findImVolumes(MPT_ADAPTER *ioc)if (mpt_config (ioc, &cfg) !=0 ) goto out; - mem =kmalloc (iocpage2sz,GFP_KERNEL ); + mem =kmemdup ((u8 *)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);
Signature · 1 line
2.19.1