Return-path: Received: from mail-pl0-f67.google.com ([209.85.160.67]:39117 "EHLO mail-pl0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751470AbeCNMpe (ORCPT ); Wed, 14 Mar 2018 08:45:34 -0400 From: hariprasath.elango@gmail.com To: aditya.shankar@microchip.com, gregkh@linuxfoundation.org, ganesh.krishna@microchip.com Cc: hariprasath.elango@gmail.com, linux-wireless@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/7] staging: wilc1000: use kmemdup instead of kmalloc and memcpy Date: Wed, 14 Mar 2018 18:15:01 +0530 Message-Id: (sfid-20180314_134545_035164_401D699A) In-Reply-To: References: In-Reply-To: References: Sender: linux-wireless-owner@vger.kernel.org List-ID: From: HariPrasath Elango Kmalloc followed by memcpy can be replaced by kmemdup. Signed-off-by: HariPrasath Elango Reviewed-by: Ajay Singh --- drivers/staging/wilc1000/linux_mon.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/wilc1000/linux_mon.c b/drivers/staging/wilc1000/linux_mon.c index f93f411..c6fd6b3 100644 --- a/drivers/staging/wilc1000/linux_mon.c +++ b/drivers/staging/wilc1000/linux_mon.c @@ -146,7 +146,7 @@ static int mon_mgmt_tx(struct net_device *dev, const u8 *buf, size_t len) if (!mgmt_tx) return -ENOMEM; - mgmt_tx->buff = kmalloc(len, GFP_ATOMIC); + mgmt_tx->buff = kmemdup(buf, len, GFP_ATOMIC); if (!mgmt_tx->buff) { kfree(mgmt_tx); return -ENOMEM; @@ -154,7 +154,6 @@ static int mon_mgmt_tx(struct net_device *dev, const u8 *buf, size_t len) mgmt_tx->size = len; - memcpy(mgmt_tx->buff, buf, len); wilc_wlan_txq_add_mgmt_pkt(dev, mgmt_tx, mgmt_tx->buff, mgmt_tx->size, mgmt_tx_complete); -- 2.10.0.GIT