Replace kmalloc and memcpy with kmemdup.
Problem found using coccicheck
Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
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) {