All of lore.kernel.org
 help / color / mirror / Atom feed
From: walter harms <wharms@bfs.de>
To: Benoit Taine <benoit.taine@lip6.fr>
Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH 3/18] VMCI: Use kmemdup instead of kmalloc + memcpy
Date: Mon, 26 May 2014 15:54:30 +0000	[thread overview]
Message-ID: <538363B6.2010803@bfs.de> (raw)
In-Reply-To: <1401117687-28911-3-git-send-email-benoit.taine@lip6.fr>



Am 26.05.2014 17:21, schrieb Benoit Taine:
> This issue was reported by coccicheck using the semantic patch 
> at scripts/coccinelle/api/memdup.cocci
> 
> Signed-off-by: Benoit Taine <benoit.taine@lip6.fr>
> ---
> Tested by compilation without errors.
> 
>  drivers/misc/vmw_vmci/vmci_datagram.c |    3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/misc/vmw_vmci/vmci_datagram.c b/drivers/misc/vmw_vmci/vmci_datagram.c
> index f3cdd90..d93b469 100644
> --- a/drivers/misc/vmw_vmci/vmci_datagram.c
> +++ b/drivers/misc/vmw_vmci/vmci_datagram.c
> @@ -276,11 +276,10 @@ static int dg_dispatch_as_host(u32 context_id, struct vmci_datagram *dg)
>  		}
>  
>  		/* We make a copy to enqueue. */
> -		new_dg = kmalloc(dg_size, GFP_KERNEL);
> +		new_dg = kmemdup(dg, dg_size, GFP_KERNEL);
>  		if (new_dg = NULL)
>  			return VMCI_ERROR_NO_MEM;


i can not see much of the code but this looks like
  new_dg=dg;
what is possible in c99.

re,
 wh

>  
> -		memcpy(new_dg, dg, dg_size);
>  		retval = vmci_ctx_enqueue_datagram(dg->dst.context, new_dg);
>  		if (retval < VMCI_SUCCESS) {
>  			kfree(new_dg);
> 
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

WARNING: multiple messages have this Message-ID (diff)
From: walter harms <wharms@bfs.de>
To: Benoit Taine <benoit.taine@lip6.fr>
Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH 3/18] VMCI: Use kmemdup instead of kmalloc + memcpy
Date: Mon, 26 May 2014 17:54:30 +0200	[thread overview]
Message-ID: <538363B6.2010803@bfs.de> (raw)
In-Reply-To: <1401117687-28911-3-git-send-email-benoit.taine@lip6.fr>



Am 26.05.2014 17:21, schrieb Benoit Taine:
> This issue was reported by coccicheck using the semantic patch 
> at scripts/coccinelle/api/memdup.cocci
> 
> Signed-off-by: Benoit Taine <benoit.taine@lip6.fr>
> ---
> Tested by compilation without errors.
> 
>  drivers/misc/vmw_vmci/vmci_datagram.c |    3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/misc/vmw_vmci/vmci_datagram.c b/drivers/misc/vmw_vmci/vmci_datagram.c
> index f3cdd90..d93b469 100644
> --- a/drivers/misc/vmw_vmci/vmci_datagram.c
> +++ b/drivers/misc/vmw_vmci/vmci_datagram.c
> @@ -276,11 +276,10 @@ static int dg_dispatch_as_host(u32 context_id, struct vmci_datagram *dg)
>  		}
>  
>  		/* We make a copy to enqueue. */
> -		new_dg = kmalloc(dg_size, GFP_KERNEL);
> +		new_dg = kmemdup(dg, dg_size, GFP_KERNEL);
>  		if (new_dg == NULL)
>  			return VMCI_ERROR_NO_MEM;


i can not see much of the code but this looks like
  new_dg=dg;
what is possible in c99.

re,
 wh

>  
> -		memcpy(new_dg, dg, dg_size);
>  		retval = vmci_ctx_enqueue_datagram(dg->dst.context, new_dg);
>  		if (retval < VMCI_SUCCESS) {
>  			kfree(new_dg);
> 
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

  reply	other threads:[~2014-05-26 15:54 UTC|newest]

Thread overview: 62+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-26 15:21 [PATCH 0/18] Use kmemdup instead of kmalloc + memcpy Benoit Taine
2014-05-26 15:21 ` Benoit Taine
2014-05-26 15:21 ` [PATCH 1/18] USB: storage: ene_ub6250: " Benoit Taine
2014-05-26 15:21   ` Benoit Taine
2014-05-26 15:21 ` [PATCH 3/18] VMCI: " Benoit Taine
2014-05-26 15:21   ` Benoit Taine
2014-05-26 15:54   ` walter harms [this message]
2014-05-26 15:54     ` walter harms
2014-05-26 15:21 ` [PATCH 2/18] memstick: " Benoit Taine
2014-05-26 15:21   ` Benoit Taine
2014-05-26 15:21 ` [PATCH 4/18] qla4xxx: " Benoit Taine
2014-05-26 15:21   ` Benoit Taine
2014-05-27  8:38   ` Vikas Chaudhary
2014-05-27  8:38     ` Vikas Chaudhary
2014-05-26 15:21 ` [PATCH 5/18] wcn36xx: " Benoit Taine
2014-05-26 15:21   ` Benoit Taine
2014-05-26 15:21 ` [PATCH 6/18] fusion: " Benoit Taine
2014-05-26 15:21   ` Benoit Taine
2014-05-26 15:21 ` [PATCH 7/18] qla2xxx: " Benoit Taine
2014-05-26 15:21   ` Benoit Taine
2014-05-27  5:01   ` Saurav Kashyap
2014-05-27  5:01     ` Saurav Kashyap
2014-05-26 15:21 ` [PATCH 8/18] Drivers: scsi: " Benoit Taine
2014-05-26 15:21   ` Benoit Taine
2014-05-26 15:21 ` [PATCH 9/18] staging: rtl8723au: " Benoit Taine
2014-05-26 15:21   ` Benoit Taine
2014-05-26 15:43   ` Jes Sorensen
2014-05-26 15:43     ` Jes Sorensen
2014-05-26 15:57     ` Benoit Taine
2014-05-26 15:57       ` Benoit Taine
2014-05-26 15:21 ` [PATCH 10/18] aacraid: " Benoit Taine
2014-05-26 15:21   ` Benoit Taine
2014-05-26 15:21 ` [PATCH 11/18] usb: gadget: " Benoit Taine
2014-05-26 15:21   ` Benoit Taine
2014-05-26 15:21 ` [PATCH 12/18] aic7xxx: " Benoit Taine
2014-05-26 15:21   ` Benoit Taine
2014-05-26 15:21 ` [PATCH 13/18] drm/edid: " Benoit Taine
2014-05-26 15:21   ` Benoit Taine
2014-05-27  6:40   ` Jani Nikula
2014-05-27  6:40     ` Jani Nikula
2014-05-27  6:40     ` Jani Nikula
2014-05-27 15:14   ` Alex Deucher
2014-05-27 15:14     ` Alex Deucher
2014-05-27 15:14     ` Alex Deucher
2014-05-26 15:21 ` [PATCH 14/18] r8152: " Benoit Taine
2014-05-26 15:21   ` Benoit Taine
2014-05-30 23:25   ` David Miller
2014-05-30 23:25     ` David Miller
2014-05-26 15:21 ` [PATCH 15/18] Drivers: media: " Benoit Taine
2014-05-26 15:21   ` Benoit Taine
2014-05-26 15:21 ` [PATCH 16/18] HID: uhid: " Benoit Taine
2014-05-26 15:21   ` Benoit Taine
2014-05-26 15:33   ` David Herrmann
2014-05-26 15:33     ` David Herrmann
2014-05-26 22:42   ` Jiri Kosina
2014-05-26 22:42     ` Jiri Kosina
2014-05-26 15:21 ` [PATCH 17/18] drx-j: " Benoit Taine
2014-05-26 15:21   ` Benoit Taine
2014-05-26 15:21 ` [PATCH 18/18] pinctrl: pinconf-generic: " Benoit Taine
2014-05-26 15:21   ` Benoit Taine
2014-05-27 14:06   ` Linus Walleij
2014-05-27 14:06     ` Linus Walleij

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=538363B6.2010803@bfs.de \
    --to=wharms@bfs.de \
    --cc=benoit.taine@lip6.fr \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.