From: Chaehyun Lim Date: Tue, 22 Sep 2015 13:47:40 +0000 (+0900) Subject: staging: wilc1000: replace kmalloc/memcpy with kmemdup X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=02cf299d0e281efc930bf1bd01479897d9ec483e;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git staging: wilc1000: replace kmalloc/memcpy with kmemdup This patch replaces kmalloc followed by memset and memcpy with kmemdup. Signed-off-by: Chaehyun Lim Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/wilc1000/coreconfigurator.c b/drivers/staging/wilc1000/coreconfigurator.c index d8b8c3d86be0..875b769d95a9 100644 --- a/drivers/staging/wilc1000/coreconfigurator.c +++ b/drivers/staging/wilc1000/coreconfigurator.c @@ -488,13 +488,10 @@ s32 ParseNetworkInfo(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo) u16IEsLen = u16RxLen - (MAC_HDR_LEN + TIME_STAMP_LEN + BEACON_INTERVAL_LEN + CAP_INFO_LEN); if (u16IEsLen > 0) { - pstrNetworkInfo->pu8IEs = kmalloc(u16IEsLen, GFP_KERNEL); + pstrNetworkInfo->pu8IEs = kmemdup(pu8IEs, u16IEsLen, + GFP_KERNEL); if (!pstrNetworkInfo->pu8IEs) return -ENOMEM; - - memset((void *)(pstrNetworkInfo->pu8IEs), 0, u16IEsLen); - - memcpy(pstrNetworkInfo->pu8IEs, pu8IEs, u16IEsLen); } pstrNetworkInfo->u16IEsLen = u16IEsLen; @@ -578,13 +575,10 @@ s32 ParseAssocRespInfo(u8 *pu8Buffer, u32 u32BufferLen, pu8IEs = &pu8Buffer[CAP_INFO_LEN + STATUS_CODE_LEN + AID_LEN]; u16IEsLen = u16AssocRespLen - (CAP_INFO_LEN + STATUS_CODE_LEN + AID_LEN); - pstrConnectRespInfo->pu8RespIEs = kmalloc(u16IEsLen, GFP_KERNEL); + pstrConnectRespInfo->pu8RespIEs = kmemdup(pu8IEs, u16IEsLen, GFP_KERNEL); if (!pstrConnectRespInfo->pu8RespIEs) return -ENOMEM; - memset((void *)(pstrConnectRespInfo->pu8RespIEs), 0, u16IEsLen); - - memcpy(pstrConnectRespInfo->pu8RespIEs, pu8IEs, u16IEsLen); pstrConnectRespInfo->u16RespIEsLen = u16IEsLen; }