Commit 5877debe authored by Muhammad Falak R Wani's avatar Muhammad Falak R Wani Committed by David S. Miller

ps3_gelic: use kmemdup

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: default avatarMuhammad Falak R Wani <falakreyaz@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 7c542772
...@@ -1616,13 +1616,13 @@ static void gelic_wl_scan_complete_event(struct gelic_wl_info *wl) ...@@ -1616,13 +1616,13 @@ static void gelic_wl_scan_complete_event(struct gelic_wl_info *wl)
target->valid = 1; target->valid = 1;
target->eurus_index = i; target->eurus_index = i;
kfree(target->hwinfo); 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); GFP_KERNEL);
if (!target->hwinfo) if (!target->hwinfo)
continue; continue;
/* copy hw scan info */ /* copy hw scan info */
memcpy(target->hwinfo, scan_info, be16_to_cpu(scan_info->size));
target->essid_len = strnlen(scan_info->essid, target->essid_len = strnlen(scan_info->essid,
sizeof(scan_info->essid)); sizeof(scan_info->essid));
target->rate_len = 0; target->rate_len = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment