wcn36xx: Use kmemdup instead of kmalloc + memcpy
This issue was reported by coccicheck using the semantic patch at scripts/coccinelle/api/memdup.cocci Signed-off-by: Benoit Taine <benoit.taine@lip6.fr> Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
parent
55fdb8585d
commit
304014a6ba
1 changed files with 1 additions and 2 deletions
|
@ -2068,7 +2068,7 @@ static void wcn36xx_smd_rsp_process(struct wcn36xx *wcn, void *buf, size_t len)
|
|||
if (!msg_ind)
|
||||
goto nomem;
|
||||
msg_ind->msg_len = len;
|
||||
msg_ind->msg = kmalloc(len, GFP_KERNEL);
|
||||
msg_ind->msg = kmemdup(buf, len, GFP_KERNEL);
|
||||
if (!msg_ind->msg) {
|
||||
kfree(msg_ind);
|
||||
nomem:
|
||||
|
@ -2080,7 +2080,6 @@ static void wcn36xx_smd_rsp_process(struct wcn36xx *wcn, void *buf, size_t len)
|
|||
msg_header->msg_type);
|
||||
break;
|
||||
}
|
||||
memcpy(msg_ind->msg, buf, len);
|
||||
mutex_lock(&wcn->hal_ind_mutex);
|
||||
list_add_tail(&msg_ind->list, &wcn->hal_ind_queue);
|
||||
queue_work(wcn->hal_ind_wq, &wcn->hal_ind_work);
|
||||
|
|
Loading…
Add table
Reference in a new issue