diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index b870809037b11ff5a0d3ba71dfeae59eb7019cbc..db7060f2ba12dc51e736b8282fb1ca2e555f691b 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; }