* [PATCH] message/fusion/mptbase.c: Use kmemdup instead of memcpy and kmalloc
@ 2019-05-22 9:53 Bharath Vedartham
2019-05-22 11:48 ` Joe Perches
0 siblings, 1 reply; 3+ messages in thread
From: Bharath Vedartham @ 2019-05-22 9:53 UTC (permalink / raw)
To: sathya.prakash, chaitra.basappa
Cc: MPT-FusionLinux.pdl, linux-scsi, linux-kernel
Replace kmalloc + memcpy with kmemdup.
This was reported by coccinelle.
Signed-off-by: Bharath Vedartham <linux.bhar@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 d8882b0..37876a7 100644
--- a/drivers/message/fusion/mptbase.c
+++ b/drivers/message/fusion/mptbase.c
@@ -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);
--
2.7.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] message/fusion/mptbase.c: Use kmemdup instead of memcpy and kmalloc
2019-05-22 9:53 [PATCH] message/fusion/mptbase.c: Use kmemdup instead of memcpy and kmalloc Bharath Vedartham
@ 2019-05-22 11:48 ` Joe Perches
2019-05-22 15:56 ` Bharath Vedartham
0 siblings, 1 reply; 3+ messages in thread
From: Joe Perches @ 2019-05-22 11:48 UTC (permalink / raw)
To: Bharath Vedartham, sathya.prakash, chaitra.basappa
Cc: MPT-FusionLinux.pdl, linux-scsi, linux-kernel
On Wed, 2019-05-22 at 15:23 +0530, Bharath Vedartham wrote:
> Replace kmalloc + memcpy with kmemdup.
> This was reported by coccinelle.
[]
> diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c
[]
> @@ -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);
You should remove the unnecessary cast here.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] message/fusion/mptbase.c: Use kmemdup instead of memcpy and kmalloc
2019-05-22 11:48 ` Joe Perches
@ 2019-05-22 15:56 ` Bharath Vedartham
0 siblings, 0 replies; 3+ messages in thread
From: Bharath Vedartham @ 2019-05-22 15:56 UTC (permalink / raw)
To: Joe Perches
Cc: sathya.prakash, chaitra.basappa, MPT-FusionLinux.pdl, linux-scsi,
linux-kernel
On Wed, May 22, 2019 at 04:48:33AM -0700, Joe Perches wrote:
> On Wed, 2019-05-22 at 15:23 +0530, Bharath Vedartham wrote:
> > Replace kmalloc + memcpy with kmemdup.
> > This was reported by coccinelle.
> []
> > diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c
> []
> > @@ -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);
>
> You should remove the unnecessary cast here.
>
>
Yes! I will change this in v2.
Thanks
Bharath
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-05-22 15:57 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-22 9:53 [PATCH] message/fusion/mptbase.c: Use kmemdup instead of memcpy and kmalloc Bharath Vedartham
2019-05-22 11:48 ` Joe Perches
2019-05-22 15:56 ` Bharath Vedartham
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).