Skip to content

Commit

Permalink
misc/vmw_vmci: use kmemdup rather than duplicating its implementation
Browse files Browse the repository at this point in the history
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Andrzej Hajda authored and Greg Kroah-Hartman committed Sep 21, 2015
1 parent 1f93e4a commit bf84b14
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions drivers/misc/vmw_vmci/vmci_datagram.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

memcpy(new_dg, dg, dg_size);
retval = vmci_ctx_enqueue_datagram(dg->dst.context, new_dg);
if (retval < VMCI_SUCCESS) {
kfree(new_dg);
Expand Down

0 comments on commit bf84b14

Please sign in to comment.