summaryrefslogtreecommitdiff
path: root/drivers/staging/wlan-ng
diff options
context:
space:
mode:
authorXenia Ragiadakou <burzalodowa@gmail.com>2013-05-13 06:07:15 +0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-05-14 01:01:26 +0400
commit57e6d784404f796a3b8d0124210d9608ea20e279 (patch)
treec2845ec6ab64affad6f9e70ca39a8b8b6b90e9fa /drivers/staging/wlan-ng
parentc7cd6e92ddfb16f52651fdaefde7f639f4fa4f7c (diff)
downloadlinux-57e6d784404f796a3b8d0124210d9608ea20e279.tar.xz
wlan-ng: replace calls to kmalloc and memcpy with kmemdup
This patch replaces calls to kmalloc that are followed by memcpy with calls to kmemdup. This patch was found using coccicheck with api/memdup.cocci, with memdup.cocci script slightly altered in the following way: @depends on patch@ expression from,to,size,flag; position p != {r1.p,r2.p}; @@ - to = \(kmalloc@p\|kzalloc@p\)(size,flag); + to = kmemdup(from,size,flag); - memcpy(to, from, size); Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/wlan-ng')
-rw-r--r--drivers/staging/wlan-ng/prism2sta.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/staging/wlan-ng/prism2sta.c b/drivers/staging/wlan-ng/prism2sta.c
index 428a9be25010..76374b220228 100644
--- a/drivers/staging/wlan-ng/prism2sta.c
+++ b/drivers/staging/wlan-ng/prism2sta.c
@@ -1122,8 +1122,7 @@ static void prism2sta_inf_hostscanresults(wlandevice_t *wlandev,
kfree(hw->scanresults);
- hw->scanresults = kmalloc(sizeof(hfa384x_InfFrame_t), GFP_ATOMIC);
- memcpy(hw->scanresults, inf, sizeof(hfa384x_InfFrame_t));
+ hw->scanresults = kmemdup(inf, sizeof(hfa384x_InfFrame_t), GFP_ATOMIC);
if (nbss == 0)
nbss = -1;