Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752131AbbKYKH6 (ORCPT ); Wed, 25 Nov 2015 05:07:58 -0500 Received: from mail-pa0-f54.google.com ([209.85.220.54]:34614 "EHLO mail-pa0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751939AbbKYKHa (ORCPT ); Wed, 25 Nov 2015 05:07:30 -0500 From: Anup Limbu To: davem@davemloft.net, mjg59@srcf.ucam.org, tklauser@distanz.com, linux-usb@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Anup Limbu Subject: [PATCH] net: usb: ch9200: use kmemdup instead of kmalloc + memcpy Date: Wed, 25 Nov 2015 15:37:21 +0530 Message-Id: <1448446041-15663-1-git-send-email-anuplimbu14@gmail.com> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 919 Lines: 33 replace kmalloc + memset with kmemdup Signed-off-by: Anup Limbu --- drivers/net/usb/ch9200.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/net/usb/ch9200.c b/drivers/net/usb/ch9200.c index 5e151e6..8a40202 100644 --- a/drivers/net/usb/ch9200.c +++ b/drivers/net/usb/ch9200.c @@ -155,12 +155,11 @@ static int control_write(struct usbnet *dev, unsigned char request, index, size); if (data) { - buf = kmalloc(size, GFP_KERNEL); + buf = kmemdup(data, size, GFP_KERNEL); if (!buf) { err = -ENOMEM; goto err_out; } - memcpy(buf, data, size); } err = usb_control_msg(dev->udev, -- 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/