diff mbox

[15/30] staging: wilc1000: use kmemdup in wilc_edit_station

Message ID 1451810162-16993-15-git-send-email-chaehyun.lim@gmail.com (mailing list archive)
State Not Applicable
Delegated to: Kalle Valo
Headers show

Commit Message

Chaehyun Lim Jan. 3, 2016, 8:35 a.m. UTC
This patch replaces kmalloc followed by memcpy with kmemdup.

Signed-off-by: Chaehyun Lim <chaehyun.lim@gmail.com>
---
 drivers/staging/wilc1000/host_interface.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
diff mbox

Patch

diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c
index 2f94804..290c27a 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -4372,13 +4372,11 @@  int wilc_edit_station(struct wilc_vif *vif,
 
 	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;
 	}