* [PATCH] ps3_gelic: use kmemdup
@ 2016-05-19 13:54 Muhammad Falak R Wani
2016-05-20 23:50 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Muhammad Falak R Wani @ 2016-05-19 13:54 UTC (permalink / raw)
To: Benjamin Herrenschmidt
Cc: Paul Mackerras, Michael Ellerman, David S. Miller,
Christophe Jaillet, netdev, linuxppc-dev, linux-kernel
Use kmemdup when some other buffer is immediately copied into allocated
region. It replaces call to allocation followed by memcpy, by a single
call to kmemdup.
Signed-off-by: Muhammad Falak R Wani <falakreyaz@gmail.com>
---
drivers/net/ethernet/toshiba/ps3_gelic_wireless.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/toshiba/ps3_gelic_wireless.c b/drivers/net/ethernet/toshiba/ps3_gelic_wireless.c
index 743b182..446ea58 100644
--- a/drivers/net/ethernet/toshiba/ps3_gelic_wireless.c
+++ b/drivers/net/ethernet/toshiba/ps3_gelic_wireless.c
@@ -1616,13 +1616,13 @@ static void gelic_wl_scan_complete_event(struct gelic_wl_info *wl)
target->valid = 1;
target->eurus_index = i;
kfree(target->hwinfo);
- target->hwinfo = kzalloc(be16_to_cpu(scan_info->size),
+ target->hwinfo = kmemdup(scan_info,
+ be16_to_cpu(scan_info->size),
GFP_KERNEL);
if (!target->hwinfo)
continue;
/* copy hw scan info */
- memcpy(target->hwinfo, scan_info, be16_to_cpu(scan_info->size));
target->essid_len = strnlen(scan_info->essid,
sizeof(scan_info->essid));
target->rate_len = 0;
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] ps3_gelic: use kmemdup
2016-05-19 13:54 [PATCH] ps3_gelic: use kmemdup Muhammad Falak R Wani
@ 2016-05-20 23:50 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2016-05-20 23:50 UTC (permalink / raw)
To: falakreyaz
Cc: benh, paulus, mpe, christophe.jaillet, netdev, linuxppc-dev,
linux-kernel
From: Muhammad Falak R Wani <falakreyaz@gmail.com>
Date: Thu, 19 May 2016 19:24:41 +0530
> Use kmemdup when some other buffer is immediately copied into allocated
> region. It replaces call to allocation followed by memcpy, by a single
> call to kmemdup.
>
> Signed-off-by: Muhammad Falak R Wani <falakreyaz@gmail.com>
Applied.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-05-20 23:50 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-19 13:54 [PATCH] ps3_gelic: use kmemdup Muhammad Falak R Wani
2016-05-20 23:50 ` David Miller
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).