* [PATCH] message: fusion: Use kmemdup instead of kmalloc and memcpy
@ 2016-12-23 19:24 Shyam Saini
0 siblings, 0 replies; only message in thread
From: Shyam Saini @ 2016-12-23 19:24 UTC (permalink / raw)
To: sathya.prakash
Cc: chaitra.basappa, suganath-prabu.subramani, linux-scsi,
Shyam Saini
When some other buffer is immediately copied into allocated region.
Replace calls to kmalloc followed by a memcpy with a direct
call to kmemdup.
Signed-off-by: Shyam Saini <mayhs11saini@gmail.com>
---
drivers/message/fusion/mptbase.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c
index 1e73064..7b46462 100644
--- a/drivers/message/fusion/mptbase.c
+++ b/drivers/message/fusion/mptbase.c
@@ -5995,13 +5995,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);
--
2.7.4
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2016-12-23 19:24 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-23 19:24 [PATCH] message: fusion: Use kmemdup instead of kmalloc and memcpy Shyam Saini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).