Received: by 10.213.65.68 with SMTP id h4csp166271imn; Mon, 12 Mar 2018 23:22:20 -0700 (PDT) X-Google-Smtp-Source: AG47ELunKphEZsEf3je+FFVIy1pMsWWqWLKsyNhlvn/OZXDT0W96tziL2zsATIUewo547Uwk6s3c X-Received: by 2002:a17:902:be02:: with SMTP id r2-v6mr10604408pls.234.1520922140442; Mon, 12 Mar 2018 23:22:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1520922140; cv=none; d=google.com; s=arc-20160816; b=rSNVCSwt9gDItIlGVV3840vrgb9omjat/OFbd9Wvr3OZxDBxZhrKMxUty3dYRI5XV2 2SKZDHSovvOoXH+5m/lDh6W/GxtiPImClWpPrCFwxQAt/3d1e9qcfsUP+Nc0tCey5g2S 62s+w358WeOKcG66uFbEsgDrvYjjSPwiWlC+EfUHrCtis3skF9M4nHgjHw2OmkTftjTY GoGusvMwHJwLkmUDGdV9GWTxXb5g6x2UoQJBtAlFvV8WmRaa7VL3UwSbdJLXz1PDjnAd aWrXVsizAM1R76ZS50IXoDKQHbz8fcMDHtA0uKFgtKzVZazvXZ40djMOMgvGBu1R97Ic aXnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=OQglFu6Z7vEQL92l4t0WxsZPG2fXJVz0FUXBIQivrS8=; b=lc98vuApDOUvYv9Cz5M9cWFaWJj5SklG6zX1hNK5bGPs7LMzECvMrs1d5SC6K9GZKC lZxpKL2TQiUJcHPyOqQnNd4jUF+baTPD89t6cbEQCmQEKVT8EczZxPNDE9ynDn5gDI4H g/t/mXonph9ZCR0aN6zWmE4EqVzN6AwIATqsPyn8F4dowrdQZDwXvFolNG8GG+MnQFv7 ejFg4ZNEfMqnCbqpvuFhZA2z8pCpNgkr1ZQF2ts1A9rE0L2nthqhEiZDz5uK+SsotkSg cpRuq1EP1cJjKGNoGhdD9vrrhnCICFgLEERdp2AnNgHktT+2ulVDQbIw8Q7ikM2Jb5JK vAQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=QRq+0ZxZ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w11si6110255pgo.826.2018.03.12.23.22.06; Mon, 12 Mar 2018 23:22:20 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=QRq+0ZxZ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751822AbeCMGVQ (ORCPT + 99 others); Tue, 13 Mar 2018 02:21:16 -0400 Received: from mail-pl0-f66.google.com ([209.85.160.66]:37193 "EHLO mail-pl0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751462AbeCMGVP (ORCPT ); Tue, 13 Mar 2018 02:21:15 -0400 Received: by mail-pl0-f66.google.com with SMTP id w12-v6so10788562plp.4; Mon, 12 Mar 2018 23:21:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=OQglFu6Z7vEQL92l4t0WxsZPG2fXJVz0FUXBIQivrS8=; b=QRq+0ZxZNHFXUpX3ruOz+qApI/ifvURANNuuf9VU1yMH8nci0DJ2dyA5GkUA/Ig+be q1uqxRB4tVeCKncUzUDvL2CigeNJHSOqg6iZGPeRTLc0fE7AcxL74dCj+D1t09+WFvFO yw701mycuHe/pYOSNmxfE2YdhGCobVui7p7LQU/iRonsDOjUv8PRCATqrNhjBSdjkbtW LlITrMXVBUUbZD6i3q0YU/ANs/Kv5X+SEZlVPAnaNAFrI/tZqiI/oCbtI49ZAkWvMgI6 FaO2WwcQoz35hwrQTul649uDBayRyPUgTjMNuCfIWozqJmYQmD7CRj2ydZrNmZYEksOM ncmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=OQglFu6Z7vEQL92l4t0WxsZPG2fXJVz0FUXBIQivrS8=; b=ajaWT0ya5BWvY8zFgfmKytMim0oywfdFuHMJf7sxUgzY28HUiKTtmiduRop7uiLT4L lq0+OJIOwgsxgpZ/EOCwxQRsFZCEWcOpAfeebd9vF5h5VNCgiITmGY1o77oUZgm6vU3U PFo2zf5EebRsV7amO4gFAJ8Rwh9TpOEOlx1tmcxajSgTf1fiXGFJA0dpmJvsXC+GKIn3 Ks1iJmITd1bKa8RNZmNZvN4UcwvsLyYx1KsDRJwGOmXGLGpvoUhDsMy2BugBh3DBJnZp i//SNDi3uaemyV3IRXIq+4Po/B1rwAOSqi7ECoNyj3ccL4XW5NighVNJC7+9t9jq9LPU 9bpg== X-Gm-Message-State: AElRT7FIn5c+ptRUE3b6dTNnicoftMzViSSPdt9HcPBmI2EFsYqZ5jx7 cLOHMQDXldyv/+qWoCdrJ+Q= X-Received: by 2002:a17:902:aa03:: with SMTP id be3-v6mr10472494plb.211.1520922074743; Mon, 12 Mar 2018 23:21:14 -0700 (PDT) Received: from localhost.localdomain ([2405:204:714b:73d3:f099:e200:ca11:baf8]) by smtp.gmail.com with ESMTPSA id v14sm21326301pfi.8.2018.03.12.23.21.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 12 Mar 2018 23:21:13 -0700 (PDT) From: hariprasath.elango@gmail.com To: aditya.shankar@microchip.com Cc: hariprasath.elango@gmail.com, vbabu3@visteon.com, Ganesh Krishna , Greg Kroah-Hartman , linux-wireless@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH] staging: wilc1000: use kmemdup instead of kmalloc and memcpy Date: Tue, 13 Mar 2018 11:50:48 +0530 Message-Id: <20180313062049.6200-1-hariprasath.elango@gmail.com> X-Mailer: git-send-email 2.10.0.GIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: HariPrasath Elango Kmalloc followed by memcpy can be replaced by kmemdup. Signed-off-by: HariPrasath Elango --- 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