Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751987AbbHGIMb (ORCPT ); Fri, 7 Aug 2015 04:12:31 -0400 Received: from mailout4.w1.samsung.com ([210.118.77.14]:25476 "EHLO mailout4.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932256AbbHGIAh (ORCPT ); Fri, 7 Aug 2015 04:00:37 -0400 X-AuditID: cbfec7f5-f794b6d000001495-05-55c465a4e6b9 From: Andrzej Hajda To: Greg Kroah-Hartman , Dan Carpenter Cc: Andrzej Hajda , Bartlomiej Zolnierkiewicz , Marek Szyprowski , linux-kernel@vger.kernel.org Subject: [PATCH 15/31] misc/vmw_vmci: use kmemdup rather than duplicating its implementation Date: Fri, 07 Aug 2015 09:59:21 +0200 Message-id: <1438934377-4922-16-git-send-email-a.hajda@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1438934377-4922-1-git-send-email-a.hajda@samsung.com> References: <1438934377-4922-1-git-send-email-a.hajda@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupmluLIzCtJLcpLzFFi42I5/e/4Fd0lqUdCDZo2yFjcWneO1WLjjPWs Fq//TWexaF68ns3i8q45bBZrj9xld2Dz2D93DbvHx6e3WDz6tqxi9Pi8SS6AJYrLJiU1J7Ms tUjfLoEr4+aCVraCh+wVK6f+ZWlgPMjWxcjJISFgInF94m12CFtM4sK99UBxLg4hgaWMEvOW voRympgkrvW0s4JUsQloSvzdfBOsW0QgXmJKz3MWkCJmgTWMEh2TtrGAJIQF4iQenD/BBGKz CKhKzOs6BNbAK+Assf3dAiaIdXISJ49NBhvKCRRf2T0TzBYScJJ403eBeQIj7wJGhlWMoqml yQXFSem5RnrFibnFpXnpesn5uZsYIUH0dQfj0mNWhxgFOBiVeHgT/h0OFWJNLCuuzD3EKMHB rCTC+1AfKMSbklhZlVqUH19UmpNafIhRmoNFSZx35q73IUIC6YklqdmpqQWpRTBZJg5OqQZG hnAn25/b/B6H7Ba+HLBU6lXGLpnHSonz6t+V783+uHLbL9VFX8ts5LadyivyO6eyym5R5rU9 P8smyyUt+Cfxt08vZpp3WpxKiIzp3CN7JNq0P0y3C4r+vNnDk8Hd/NqqNT9fOZ0KYuM9JssU vOBZzFf7bcJq67OsuAMtU468qRLd+ezcnk9RSizFGYmGWsxFxYkA6zxXhh4CAAA= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1208 Lines: 35 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 --- 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 8226652..8a4b6bb 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; - memcpy(new_dg, dg, dg_size); retval = vmci_ctx_enqueue_datagram(dg->dst.context, new_dg); if (retval < VMCI_SUCCESS) { kfree(new_dg); -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/