linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] staging: wilc1000: use kmemdup instead of kmalloc and memcpy
@ 2018-03-13  6:20 hariprasath.elango
  2018-03-13  7:43 ` Ajay Singh
  0 siblings, 1 reply; 2+ messages in thread
From: hariprasath.elango @ 2018-03-13  6:20 UTC (permalink / raw)
  To: aditya.shankar
  Cc: hariprasath.elango, vbabu3, Ganesh Krishna, Greg Kroah-Hartman,
	linux-wireless, devel, linux-kernel

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>
---
 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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] staging: wilc1000: use kmemdup instead of kmalloc and memcpy
  2018-03-13  6:20 [PATCH] staging: wilc1000: use kmemdup instead of kmalloc and memcpy hariprasath.elango
@ 2018-03-13  7:43 ` Ajay Singh
  0 siblings, 0 replies; 2+ messages in thread
From: Ajay Singh @ 2018-03-13  7:43 UTC (permalink / raw)
  To: hariprasath.elango, linux-kernel
  Cc: aditya.shankar, vbabu3, Ganesh Krishna, Greg Kroah-Hartman,
	linux-wireless, devel

On Tue, 13 Mar 2018 11:50:48 +0530
<hariprasath.elango@gmail.com> wrote:

> 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>


Regards,
Ajay

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-03-13  7:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-13  6:20 [PATCH] staging: wilc1000: use kmemdup instead of kmalloc and memcpy hariprasath.elango
2018-03-13  7:43 ` Ajay Singh

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).