linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
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	[thread overview]
Message-ID: <eb6f1bd272febe81ba4d632e377f4e3a6ca27cf4.1521030891.git.hariprasath.elango@gmail.com> (raw)
In-Reply-To: <cover.1521030891.git.hariprasath.elango@gmail.com>
In-Reply-To: <cover.1521030891.git.hariprasath.elango@gmail.com>

From: HariPrasath Elango <hariprasath.elango@gmail.com>

Kmalloc followed by memcpy can be replaced by kmemdup.

Signed-off-by: HariPrasath Elango <hariprasath.elango@gmail.com>
Reviewed-by: Ajay Singh <ajay.kathat@microchip.com>
---
 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

  parent reply	other threads:[~2018-03-14 12:45 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-14 12:44 [PATCH 0/7] Cleanup patches for wilc1000 driver hariprasath.elango
2018-03-14 12:44 ` [PATCH 1/7] staging: wilc1000: Fix code block alignment hariprasath.elango
2018-03-14 12:45 ` [PATCH 2/7] staging: wilc1000: Destroy mutex object in deinitialization hariprasath.elango
2018-03-14 12:45 ` hariprasath.elango [this message]
2018-03-14 12:45 ` [PATCH 4/7] staging: wilc1000: destroy initialized mutex object hariprasath.elango
2018-03-14 12:45 ` [PATCH 5/7] staging: wilc1000: replace switch statement by simple if condition hariprasath.elango
2018-03-19 18:45   ` Greg KH
2018-03-20  6:12     ` <Hariprasath Elango>
2018-03-20 11:29       ` Dan Carpenter
2018-03-20 11:42         ` <Hariprasath Elango>
2018-03-14 12:45 ` [PATCH 6/7] staging: wilc1000: remove unwanted braces and correct code alignment hariprasath.elango
2018-03-14 14:08   ` Ajay Singh
2018-03-14 12:45 ` [PATCH 7/7] staging: wilc1000: use kmemdup to replace kmalloc/memcpy hariprasath.elango
2018-03-16 10:18   ` kbuild test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=eb6f1bd272febe81ba4d632e377f4e3a6ca27cf4.1521030891.git.hariprasath.elango@gmail.com \
    --to=hariprasath.elango@gmail.com \
    --cc=aditya.shankar@microchip.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=ganesh.krishna@microchip.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).