diff mbox

[14/31] message/fusion: use kmemdup rather than duplicating its implementation

Message ID 1438934377-4922-15-git-send-email-a.hajda@samsung.com (mailing list archive)
State New, archived
Headers show

Commit Message

Andrzej Hajda Aug. 7, 2015, 7:59 a.m. UTC
The patch was generated using fixed coccinelle semantic patch
scripts/coccinelle/api/memdup.cocci [1].

[1]: http://permalink.gmane.org/gmane.linux.kernel/2014320

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
---
 drivers/message/fusion/mptbase.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Andrzej Hajda Sept. 16, 2015, 10:01 a.m. UTC | #1
Ping.

Regards
Andrzej

On 08/07/2015 09:59 AM, Andrzej Hajda wrote:
> The patch was generated using fixed coccinelle semantic patch
> scripts/coccinelle/api/memdup.cocci [1].
>
> [1]: http://permalink.gmane.org/gmane.linux.kernel/2014320
>
> Signed-off-by: Andrzej Hajda <a.hajda@samsung.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 5dcc031..1551f51 100644
> --- a/drivers/message/fusion/mptbase.c
> +++ b/drivers/message/fusion/mptbase.c
> @@ -5971,13 +5971,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);

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c
index 5dcc031..1551f51 100644
--- a/drivers/message/fusion/mptbase.c
+++ b/drivers/message/fusion/mptbase.c
@@ -5971,13 +5971,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);