From: Shraddha Barke Date: Sun, 11 Oct 2015 16:31:37 +0000 (+0530) Subject: Staging: wilc1000: wilc_msgqueue: Use kmemdup instead of kmalloc and memcpy X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=c22cbec069b532c4a9a33236305ee4d833ec67e6;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git Staging: wilc1000: wilc_msgqueue: Use kmemdup instead of kmalloc and memcpy Replace kmalloc and memcpy with kmemdup. Problem found using coccicheck Signed-off-by: Shraddha Barke Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/wilc1000/wilc_msgqueue.c b/drivers/staging/wilc1000/wilc_msgqueue.c index d5ebd6d08db7..b13809a4b556 100644 --- a/drivers/staging/wilc1000/wilc_msgqueue.c +++ b/drivers/staging/wilc1000/wilc_msgqueue.c @@ -80,12 +80,12 @@ int wilc_mq_send(WILC_MsgQueueHandle *pHandle, return -ENOMEM; pstrMessage->u32Length = u32SendBufferSize; pstrMessage->pstrNext = NULL; - pstrMessage->pvBuffer = kmalloc(u32SendBufferSize, GFP_ATOMIC); + pstrMessage->pvBuffer = kmemdup(pvSendBuffer, u32SendBufferSize, + GFP_ATOMIC); if (!pstrMessage->pvBuffer) { result = -ENOMEM; goto ERRORHANDLER; } - memcpy(pstrMessage->pvBuffer, pvSendBuffer, u32SendBufferSize); /* add it to the message queue */ if (!pHandle->pstrMessageList) {