Commit bf84b140 authored by Andrzej Hajda's avatar Andrzej Hajda Committed by Greg Kroah-Hartman

misc/vmw_vmci: use kmemdup rather than duplicating its implementation

The patch was generated using fixed coccinelle semantic patch
scripts/coccinelle/api/memdup.cocci [1].

[1]: http://permalink.gmane.org/gmane.linux.kernel/2014320Signed-off-by: default avatarAndrzej Hajda <a.hajda@samsung.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 1f93e4a9
...@@ -276,11 +276,10 @@ static int dg_dispatch_as_host(u32 context_id, struct vmci_datagram *dg) ...@@ -276,11 +276,10 @@ static int dg_dispatch_as_host(u32 context_id, struct vmci_datagram *dg)
} }
/* We make a copy to enqueue. */ /* 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) if (new_dg == NULL)
return VMCI_ERROR_NO_MEM; return VMCI_ERROR_NO_MEM;
memcpy(new_dg, dg, dg_size);
retval = vmci_ctx_enqueue_datagram(dg->dst.context, new_dg); retval = vmci_ctx_enqueue_datagram(dg->dst.context, new_dg);
if (retval < VMCI_SUCCESS) { if (retval < VMCI_SUCCESS) {
kfree(new_dg); kfree(new_dg);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment