From: Chaehyun Lim Date: Fri, 6 Nov 2015 10:11:20 +0000 (+0900) Subject: staging: wilc1000: use kmemdup in host_int_add_station X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=7897bd00f6b5e69443ceffc7900faaafc23455b0;p=openwrt%2Fstaging%2Fblogic.git staging: wilc1000: use kmemdup in host_int_add_station This patch replaces kmalloc followed by memcpy with kmemdup. Signed-off-by: Chaehyun Lim Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index b870809037b1..db7060f2ba12 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -4560,13 +4560,11 @@ int host_int_add_station(struct host_if_drv *hif_drv, memcpy(add_sta_info, sta_param, sizeof(struct add_sta_param)); if (add_sta_info->rates_len > 0) { - u8 *rates = kmalloc(add_sta_info->rates_len, GFP_KERNEL); - + u8 *rates = kmemdup(sta_param->rates, + add_sta_info->rates_len, + GFP_KERNEL); if (!rates) return -ENOMEM; - - memcpy(rates, sta_param->rates, - add_sta_info->rates_len); add_sta_info->rates = rates; }