diff options
author | Chaehyun Lim <chaehyun.lim@gmail.com> | 2015-11-06 10:11:20 (GMT) |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-11-16 04:02:47 (GMT) |
commit | 7897bd00f6b5e69443ceffc7900faaafc23455b0 (patch) | |
tree | b78726f099a22309e6978e040e228edeac8c99c7 | |
parent | 773e02e696b1926d85627a901375453d46d12262 (diff) | |
download | linux-7897bd00f6b5e69443ceffc7900faaafc23455b0.tar.xz |
staging: wilc1000: use kmemdup in host_int_add_station
This patch replaces kmalloc followed by memcpy with kmemdup.
Signed-off-by: Chaehyun Lim <chaehyun.lim@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/staging/wilc1000/host_interface.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index b870809..db7060f 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; } |