Commit 8ab8c592 authored by Chaehyun Lim's avatar Chaehyun Lim Committed by Greg Kroah-Hartman

staging: wilc1000: use kmemdup in host_int_add_ptk

This patch changes kmalloc followed by memcpy to kmemdup
The error checking is also added when kmemdup is failed.
Signed-off-by: default avatarChaehyun Lim <chaehyun.lim@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 53bbbb57
...@@ -3239,8 +3239,9 @@ int host_int_add_ptk(struct host_if_drv *hif_drv, const u8 *ptk, ...@@ -3239,8 +3239,9 @@ int host_int_add_ptk(struct host_if_drv *hif_drv, const u8 *ptk,
if (mode == STATION_MODE) if (mode == STATION_MODE)
msg.body.key_info.action = ADDKEY; msg.body.key_info.action = ADDKEY;
msg.body.key_info.attr.wpa.key = kmalloc(ptk_key_len, GFP_KERNEL); msg.body.key_info.attr.wpa.key = kmemdup(ptk, ptk_key_len, GFP_KERNEL);
memcpy(msg.body.key_info.attr.wpa.key, ptk, ptk_key_len); if (!msg.body.key_info.attr.wpa.key)
return -ENOMEM;
if (rx_mic) { if (rx_mic) {
memcpy(msg.body.key_info.attr.wpa.key + 16, rx_mic, RX_MIC_KEY_LEN); memcpy(msg.body.key_info.attr.wpa.key + 16, rx_mic, RX_MIC_KEY_LEN);
......
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