WILC_MALLOC(size) is wrapping a call to kmalloc(size, GFP_ATOMIC) with a check for 'size > 0', which kmalloc handles anyway
The semantic patch that makes this change is as follows: @@ expression v, s; type t; identifier i; @@ ( - v = WILC_MALLOC(s); + v = kmalloc(s, GFP_ATOMIC); | - t i = WILC_MALLOC(s); + t i = kmalloc(s, GFP_ATOMIC); ) Signed-off-by: Mike Rapoport <mike.rapop...@gmail.com> --- drivers/staging/wilc1000/host_interface.c | 145 +++++++++++++++++------------- 1 file changed, 85 insertions(+), 60 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 8033205..82b585f 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -841,7 +841,7 @@ s32 Handle_get_IPAddress(tstrWILC_WFIDrv *drvHandler, u8 *pu8IPAddr, u8 idx) /*prepare configuration packet*/ strWID.u16WIDid = (u16)WID_IP_ADDRESS; strWID.enuWIDtype = WID_STR; - strWID.ps8WidVal = WILC_MALLOC(IP_ALEN); + strWID.ps8WidVal = kmalloc(IP_ALEN, GFP_ATOMIC); strWID.s32ValueSize = IP_ALEN; s32Error = SendConfigPkt(GET_CFG, &strWID, 1, true, @@ -891,7 +891,7 @@ static s32 Handle_SetMacAddress(tstrWILC_WFIDrv *drvHandler, tstrHostIfSetMacAdd s32 s32Error = WILC_SUCCESS; tstrWID strWID; tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; - u8 *mac_buf = WILC_MALLOC(ETH_ALEN); + u8 *mac_buf = kmalloc(ETH_ALEN, GFP_ATOMIC); if (mac_buf == NULL) { PRINT_ER("No buffer to send mac address\n"); @@ -1339,7 +1339,7 @@ static s32 Handle_Scan(tstrWILC_WFIDrv *drvHandler, tstrHostIFscanAttr *pstrHost for (i = 0; i < pstrHostIFscanAttr->strHiddenNetwork.u8ssidnum; i++) valuesize += ((pstrHostIFscanAttr->strHiddenNetwork.pstrHiddenNetworkInfo[i].u8ssidlen) + 1); - pu8HdnNtwrksWidVal = WILC_MALLOC(valuesize + 1); + pu8HdnNtwrksWidVal = kmalloc(valuesize + 1, GFP_ATOMIC); strWIDList[u32WidsCount].ps8WidVal = pu8HdnNtwrksWidVal; if (strWIDList[u32WidsCount].ps8WidVal != NULL) { pu8Buffer = strWIDList[u32WidsCount].ps8WidVal; @@ -1616,13 +1616,15 @@ static s32 Handle_Connect(tstrWILC_WFIDrv *drvHandler, tstrHostIFconnectAttr *ps PRINT_INFO(HOSTINF_DBG, "Saving connection parameters in global structure\n"); if (pstrHostIFconnectAttr->pu8bssid != NULL) { - pstrWFIDrv->strWILC_UsrConnReq.pu8bssid = WILC_MALLOC(6); + pstrWFIDrv->strWILC_UsrConnReq.pu8bssid = kmalloc(6, + GFP_ATOMIC); memcpy(pstrWFIDrv->strWILC_UsrConnReq.pu8bssid, pstrHostIFconnectAttr->pu8bssid, 6); } pstrWFIDrv->strWILC_UsrConnReq.ssidLen = pstrHostIFconnectAttr->ssidLen; if (pstrHostIFconnectAttr->pu8ssid != NULL) { - pstrWFIDrv->strWILC_UsrConnReq.pu8ssid = WILC_MALLOC(pstrHostIFconnectAttr->ssidLen + 1); + pstrWFIDrv->strWILC_UsrConnReq.pu8ssid = kmalloc(pstrHostIFconnectAttr->ssidLen + 1, + GFP_ATOMIC); memcpy(pstrWFIDrv->strWILC_UsrConnReq.pu8ssid, pstrHostIFconnectAttr->pu8ssid, pstrHostIFconnectAttr->ssidLen); pstrWFIDrv->strWILC_UsrConnReq.pu8ssid[pstrHostIFconnectAttr->ssidLen] = '\0'; @@ -1630,7 +1632,8 @@ static s32 Handle_Connect(tstrWILC_WFIDrv *drvHandler, tstrHostIFconnectAttr *ps pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen = pstrHostIFconnectAttr->IEsLen; if (pstrHostIFconnectAttr->pu8IEs != NULL) { - pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs = WILC_MALLOC(pstrHostIFconnectAttr->IEsLen); + pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs = kmalloc(pstrHostIFconnectAttr->IEsLen, + GFP_ATOMIC); memcpy(pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs, pstrHostIFconnectAttr->pu8IEs, pstrHostIFconnectAttr->IEsLen); } @@ -1724,13 +1727,15 @@ static s32 Handle_Connect(tstrWILC_WFIDrv *drvHandler, tstrHostIFconnectAttr *ps #endif /*WILC_PARSE_SCAN_IN_HOST*/ if (pstrHostIFconnectAttr->pu8bssid != NULL) { - pstrWFIDrv->strWILC_UsrConnReq.pu8bssid = WILC_MALLOC(6); + pstrWFIDrv->strWILC_UsrConnReq.pu8bssid = kmalloc(6, + GFP_ATOMIC); memcpy(pstrWFIDrv->strWILC_UsrConnReq.pu8bssid, pstrHostIFconnectAttr->pu8bssid, 6); } pstrWFIDrv->strWILC_UsrConnReq.ssidLen = pstrHostIFconnectAttr->ssidLen; if (pstrHostIFconnectAttr->pu8ssid != NULL) { - pstrWFIDrv->strWILC_UsrConnReq.pu8ssid = WILC_MALLOC(pstrHostIFconnectAttr->ssidLen + 1); + pstrWFIDrv->strWILC_UsrConnReq.pu8ssid = kmalloc(pstrHostIFconnectAttr->ssidLen + 1, + GFP_ATOMIC); memcpy(pstrWFIDrv->strWILC_UsrConnReq.pu8ssid, pstrHostIFconnectAttr->pu8ssid, pstrHostIFconnectAttr->ssidLen); pstrWFIDrv->strWILC_UsrConnReq.pu8ssid[pstrHostIFconnectAttr->ssidLen] = '\0'; @@ -1738,7 +1743,8 @@ static s32 Handle_Connect(tstrWILC_WFIDrv *drvHandler, tstrHostIFconnectAttr *ps pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen = pstrHostIFconnectAttr->IEsLen; if (pstrHostIFconnectAttr->pu8IEs != NULL) { - pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs = WILC_MALLOC(pstrHostIFconnectAttr->IEsLen); + pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs = kmalloc(pstrHostIFconnectAttr->IEsLen, + GFP_ATOMIC); memcpy(pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs, pstrHostIFconnectAttr->pu8IEs, pstrHostIFconnectAttr->IEsLen); } @@ -1780,7 +1786,8 @@ static s32 Handle_Connect(tstrWILC_WFIDrv *drvHandler, tstrHostIFconnectAttr *ps if (memcmp("DIRECT-", pstrHostIFconnectAttr->pu8ssid, 7)) { gu32FlushedInfoElemAsocSize = pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen; - gu8FlushedInfoElemAsoc = WILC_MALLOC(gu32FlushedInfoElemAsocSize); + gu8FlushedInfoElemAsoc = kmalloc(gu32FlushedInfoElemAsocSize, + GFP_ATOMIC); memcpy(gu8FlushedInfoElemAsoc, pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs, gu32FlushedInfoElemAsocSize); } @@ -1825,7 +1832,8 @@ static s32 Handle_Connect(tstrWILC_WFIDrv *drvHandler, tstrHostIFconnectAttr *ps strWIDList[u32WidsCount].u16WIDid = (u16)WID_JOIN_REQ_EXTENDED; strWIDList[u32WidsCount].enuWIDtype = WID_STR; strWIDList[u32WidsCount].s32ValueSize = MAX_SSID_LEN + 7; - strWIDList[u32WidsCount].ps8WidVal = WILC_MALLOC(strWIDList[u32WidsCount].s32ValueSize); + strWIDList[u32WidsCount].ps8WidVal = kmalloc(strWIDList[u32WidsCount].s32ValueSize, + GFP_ATOMIC); if (strWIDList[u32WidsCount].ps8WidVal == NULL) WILC_ERRORREPORT(s32Error, WILC_NO_MEM); @@ -1857,12 +1865,14 @@ static s32 Handle_Connect(tstrWILC_WFIDrv *drvHandler, tstrHostIFconnectAttr *ps /*Sending NoA attributes during connection*/ strWIDList[u32WidsCount].s32ValueSize = 112; /* 79; */ - strWIDList[u32WidsCount].ps8WidVal = WILC_MALLOC(strWIDList[u32WidsCount].s32ValueSize); + strWIDList[u32WidsCount].ps8WidVal = kmalloc(strWIDList[u32WidsCount].s32ValueSize, + GFP_ATOMIC); /*BugID_5137*/ if (memcmp("DIRECT-", pstrHostIFconnectAttr->pu8ssid, 7)) { gu32FlushedJoinReqSize = strWIDList[u32WidsCount].s32ValueSize; - gu8FlushedJoinReq = WILC_MALLOC(gu32FlushedJoinReqSize); + gu8FlushedJoinReq = kmalloc(gu32FlushedJoinReqSize, + GFP_ATOMIC); } if (strWIDList[u32WidsCount].ps8WidVal == NULL) WILC_ERRORREPORT(s32Error, WILC_NO_MEM); @@ -2038,7 +2048,8 @@ static s32 Handle_Connect(tstrWILC_WFIDrv *drvHandler, tstrHostIFconnectAttr *ps if (pstrHostIFconnectAttr->pu8IEs != NULL) { strConnectInfo.ReqIEsLen = pstrHostIFconnectAttr->IEsLen; - strConnectInfo.pu8ReqIEs = WILC_MALLOC(pstrHostIFconnectAttr->IEsLen); + strConnectInfo.pu8ReqIEs = kmalloc(pstrHostIFconnectAttr->IEsLen, + GFP_ATOMIC); memcpy(strConnectInfo.pu8ReqIEs, pstrHostIFconnectAttr->pu8IEs, pstrHostIFconnectAttr->IEsLen); @@ -2197,7 +2208,8 @@ static s32 Handle_ConnectTimeout(tstrWILC_WFIDrv *drvHandler) if (pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs != NULL) { strConnectInfo.ReqIEsLen = pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen; - strConnectInfo.pu8ReqIEs = WILC_MALLOC(pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen); + strConnectInfo.pu8ReqIEs = kmalloc(pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen, + GFP_ATOMIC); memcpy(strConnectInfo.pu8ReqIEs, pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs, pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen); @@ -2488,7 +2500,8 @@ static s32 Handle_RcvdGnrlAsyncInfo(tstrWILC_WFIDrv *drvHandler, tstrRcvdGnrlAsy strConnectInfo.u16RespIEsLen = pstrConnectRespInfo->u16RespIEsLen; - strConnectInfo.pu8RespIEs = WILC_MALLOC(pstrConnectRespInfo->u16RespIEsLen); + strConnectInfo.pu8RespIEs = kmalloc(pstrConnectRespInfo->u16RespIEsLen, + GFP_ATOMIC); memcpy(strConnectInfo.pu8RespIEs, pstrConnectRespInfo->pu8RespIEs, pstrConnectRespInfo->u16RespIEsLen); } @@ -2532,7 +2545,8 @@ static s32 Handle_RcvdGnrlAsyncInfo(tstrWILC_WFIDrv *drvHandler, tstrRcvdGnrlAsy if (pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs != NULL) { strConnectInfo.ReqIEsLen = pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen; - strConnectInfo.pu8ReqIEs = WILC_MALLOC(pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen); + strConnectInfo.pu8ReqIEs = kmalloc(pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen, + GFP_ATOMIC); memcpy(strConnectInfo.pu8ReqIEs, pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs, pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen); @@ -2768,7 +2782,8 @@ static int Handle_Key(tstrWILC_WFIDrv *drvHandler, tstrHostIFkeyAttr *pstrHostIF strWIDList[2].s32ValueSize = sizeof(char); - pu8keybuf = WILC_MALLOC(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8WepKeylen); + pu8keybuf = kmalloc(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8WepKeylen, + GFP_ATOMIC); if (pu8keybuf == NULL) { @@ -2798,7 +2813,8 @@ static int Handle_Key(tstrWILC_WFIDrv *drvHandler, tstrHostIFkeyAttr *pstrHostIF if (pstrHostIFkeyAttr->u8KeyAction & ADDKEY) { PRINT_D(HOSTINF_DBG, "Handling WEP key\n"); - pu8keybuf = WILC_MALLOC(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8WepKeylen + 2); + pu8keybuf = kmalloc(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8WepKeylen + 2, + GFP_ATOMIC); if (pu8keybuf == NULL) { PRINT_ER("No buffer to send Key\n"); return -1; @@ -2849,7 +2865,7 @@ static int Handle_Key(tstrWILC_WFIDrv *drvHandler, tstrHostIFkeyAttr *pstrHostIF case WPARxGtk: #ifdef WILC_AP_EXTERNAL_MLME if (pstrHostIFkeyAttr->u8KeyAction & ADDKEY_AP) { - pu8keybuf = WILC_MALLOC(RX_MIC_KEY_MSG_LEN); + pu8keybuf = kmalloc(RX_MIC_KEY_MSG_LEN, GFP_ATOMIC); if (pu8keybuf == NULL) { PRINT_ER("No buffer to send RxGTK Key\n"); ret = -1; @@ -2901,7 +2917,7 @@ static int Handle_Key(tstrWILC_WFIDrv *drvHandler, tstrHostIFkeyAttr *pstrHostIF if (pstrHostIFkeyAttr->u8KeyAction & ADDKEY) { PRINT_D(HOSTINF_DBG, "Handling group key(Rx) function\n"); - pu8keybuf = WILC_MALLOC(RX_MIC_KEY_MSG_LEN); + pu8keybuf = kmalloc(RX_MIC_KEY_MSG_LEN, GFP_ATOMIC); if (pu8keybuf == NULL) { PRINT_ER("No buffer to send RxGTK Key\n"); ret = -1; @@ -2956,7 +2972,7 @@ _WPARxGtk_end_case_: if (pstrHostIFkeyAttr->u8KeyAction & ADDKEY_AP) { - pu8keybuf = WILC_MALLOC(PTK_KEY_MSG_LEN + 1); + pu8keybuf = kmalloc(PTK_KEY_MSG_LEN + 1, GFP_ATOMIC); @@ -3004,7 +3020,7 @@ _WPARxGtk_end_case_: if (pstrHostIFkeyAttr->u8KeyAction & ADDKEY) { - pu8keybuf = WILC_MALLOC(PTK_KEY_MSG_LEN); + pu8keybuf = kmalloc(PTK_KEY_MSG_LEN, GFP_ATOMIC); @@ -3055,7 +3071,8 @@ _WPAPtk_end_case_: PRINT_D(HOSTINF_DBG, "Handling PMKSA key\n"); - pu8keybuf = WILC_MALLOC((pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFpmkidAttr.numpmkid * PMKSA_KEY_LEN) + 1); + pu8keybuf = kmalloc((pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFpmkidAttr.numpmkid * PMKSA_KEY_LEN) + 1, + GFP_ATOMIC); if (pu8keybuf == NULL) { PRINT_ER("No buffer to send PMKSA Key\n"); return -1; @@ -3451,7 +3468,7 @@ static s32 Handle_Get_InActiveTime(tstrWILC_WFIDrv *drvHandler, tstrHostIfStaIna strWID.u16WIDid = (u16)WID_SET_STA_MAC_INACTIVE_TIME; strWID.enuWIDtype = WID_STR; strWID.s32ValueSize = ETH_ALEN; - strWID.ps8WidVal = WILC_MALLOC(strWID.s32ValueSize); + strWID.ps8WidVal = kmalloc(strWID.s32ValueSize, GFP_ATOMIC); stamac = strWID.ps8WidVal; @@ -3522,7 +3539,7 @@ static void Handle_AddBeacon(tstrWILC_WFIDrv *drvHandler, tstrHostIFSetBeacon *p strWID.u16WIDid = (u16)WID_ADD_BEACON; strWID.enuWIDtype = WID_BIN; strWID.s32ValueSize = pstrSetBeaconParam->u32HeadLen + pstrSetBeaconParam->u32TailLen + 16; - strWID.ps8WidVal = WILC_MALLOC(strWID.s32ValueSize); + strWID.ps8WidVal = kmalloc(strWID.s32ValueSize, GFP_ATOMIC); if (strWID.ps8WidVal == NULL) WILC_ERRORREPORT(s32Error, WILC_NO_MEM); @@ -3693,7 +3710,7 @@ static void Handle_AddStation(tstrWILC_WFIDrv *drvHandler, tstrWILC_AddStaParam strWID.enuWIDtype = WID_BIN; strWID.s32ValueSize = WILC_ADD_STA_LENGTH + pstrStationParam->u8NumRates; - strWID.ps8WidVal = WILC_MALLOC(strWID.s32ValueSize); + strWID.ps8WidVal = kmalloc(strWID.s32ValueSize, GFP_ATOMIC); if (strWID.ps8WidVal == NULL) WILC_ERRORREPORT(s32Error, WILC_NO_MEM); @@ -3741,7 +3758,8 @@ static void Handle_DelAllSta(tstrWILC_WFIDrv *drvHandler, tstrHostIFDelAllSta *p PRINT_D(HOSTINF_DBG, "Handling delete station\n"); - strWID.ps8WidVal = WILC_MALLOC((pstrDelAllStaParam->u8Num_AssocSta * ETH_ALEN) + 1); + strWID.ps8WidVal = kmalloc((pstrDelAllStaParam->u8Num_AssocSta * ETH_ALEN) + 1, + GFP_ATOMIC); if (strWID.ps8WidVal == NULL) WILC_ERRORREPORT(s32Error, WILC_NO_MEM); @@ -3798,7 +3816,7 @@ static void Handle_DelStation(tstrWILC_WFIDrv *drvHandler, tstrHostIFDelSta *pst PRINT_D(HOSTINF_DBG, "Handling delete station\n"); - strWID.ps8WidVal = WILC_MALLOC(strWID.s32ValueSize); + strWID.ps8WidVal = kmalloc(strWID.s32ValueSize, GFP_ATOMIC); if (strWID.ps8WidVal == NULL) WILC_ERRORREPORT(s32Error, WILC_NO_MEM); @@ -3843,7 +3861,7 @@ static void Handle_EditStation(tstrWILC_WFIDrv *drvHandler, tstrWILC_AddStaParam strWID.s32ValueSize = WILC_ADD_STA_LENGTH + pstrStationParam->u8NumRates; PRINT_D(HOSTINF_DBG, "Handling edit station\n"); - strWID.ps8WidVal = WILC_MALLOC(strWID.s32ValueSize); + strWID.ps8WidVal = kmalloc(strWID.s32ValueSize, GFP_ATOMIC); if (strWID.ps8WidVal == NULL) WILC_ERRORREPORT(s32Error, WILC_NO_MEM); @@ -3919,7 +3937,7 @@ static int Handle_RemainOnChan(tstrWILC_WFIDrv *drvHandler, tstrHostIfRemainOnCh strWID.u16WIDid = (u16)WID_REMAIN_ON_CHAN; strWID.enuWIDtype = WID_STR; strWID.s32ValueSize = 2; - strWID.ps8WidVal = WILC_MALLOC(strWID.s32ValueSize); + strWID.ps8WidVal = kmalloc(strWID.s32ValueSize, GFP_ATOMIC); if (strWID.ps8WidVal == NULL) WILC_ERRORREPORT(s32Error, WILC_NO_MEM); @@ -3972,7 +3990,7 @@ static int Handle_RegisterFrame(tstrWILC_WFIDrv *drvHandler, tstrHostIfRegisterF /*prepare configuration packet*/ strWID.u16WIDid = (u16)WID_REGISTER_FRAME; strWID.enuWIDtype = WID_STR; - strWID.ps8WidVal = WILC_MALLOC(sizeof(u16) + 2); + strWID.ps8WidVal = kmalloc(sizeof(u16) + 2, GFP_ATOMIC); if (strWID.ps8WidVal == NULL) WILC_ERRORREPORT(s32Error, WILC_NO_MEM); @@ -4030,7 +4048,7 @@ static u32 Handle_ListenStateExpired(tstrWILC_WFIDrv *drvHandler, tstrHostIfRema strWID.u16WIDid = (u16)WID_REMAIN_ON_CHAN; strWID.enuWIDtype = WID_STR; strWID.s32ValueSize = 2; - strWID.ps8WidVal = WILC_MALLOC(strWID.s32ValueSize); + strWID.ps8WidVal = kmalloc(strWID.s32ValueSize, GFP_ATOMIC); if (strWID.ps8WidVal == NULL) PRINT_ER("Failed to allocate memory\n"); @@ -4158,7 +4176,7 @@ static void Handle_SetMulticastFilter(tstrWILC_WFIDrv *drvHandler, tstrHostIFSet strWID.u16WIDid = (u16)WID_SETUP_MULTICAST_FILTER; strWID.enuWIDtype = WID_BIN; strWID.s32ValueSize = sizeof(tstrHostIFSetMulti) + ((strHostIfSetMulti->u32count) * ETH_ALEN); - strWID.ps8WidVal = WILC_MALLOC(strWID.s32ValueSize); + strWID.ps8WidVal = kmalloc(strWID.s32ValueSize, GFP_ATOMIC); if (strWID.ps8WidVal == NULL) WILC_ERRORREPORT(s32Error, WILC_NO_MEM); @@ -4220,7 +4238,7 @@ static s32 Handle_AddBASession(tstrWILC_WFIDrv *drvHandler, tstrHostIfBASessionI strWID.u16WIDid = (u16)WID_11E_P_ACTION_REQ; strWID.enuWIDtype = WID_STR; - strWID.ps8WidVal = WILC_MALLOC(BLOCK_ACK_REQ_SIZE); + strWID.ps8WidVal = kmalloc(BLOCK_ACK_REQ_SIZE, GFP_ATOMIC); strWID.s32ValueSize = BLOCK_ACK_REQ_SIZE; ptr = strWID.ps8WidVal; /* *ptr++ = 0x14; */ @@ -4307,7 +4325,7 @@ static s32 Handle_DelBASession(tstrWILC_WFIDrv *drvHandler, tstrHostIfBASessionI strWID.u16WIDid = (u16)WID_11E_P_ACTION_REQ; strWID.enuWIDtype = WID_STR; - strWID.ps8WidVal = WILC_MALLOC(BLOCK_ACK_REQ_SIZE); + strWID.ps8WidVal = kmalloc(BLOCK_ACK_REQ_SIZE, GFP_ATOMIC); strWID.s32ValueSize = BLOCK_ACK_REQ_SIZE; ptr = strWID.ps8WidVal; /* *ptr++ = 0x14; */ @@ -4379,7 +4397,7 @@ static s32 Handle_DelAllRxBASessions(tstrWILC_WFIDrv *drvHandler, tstrHostIfBASe strWID.u16WIDid = (u16)WID_DEL_ALL_RX_BA; strWID.enuWIDtype = WID_STR; - strWID.ps8WidVal = WILC_MALLOC(BLOCK_ACK_REQ_SIZE); + strWID.ps8WidVal = kmalloc(BLOCK_ACK_REQ_SIZE, GFP_ATOMIC); strWID.s32ValueSize = BLOCK_ACK_REQ_SIZE; ptr = strWID.ps8WidVal; *ptr++ = 0x14; @@ -4839,8 +4857,8 @@ s32 host_int_add_wep_key_bss_sta(tstrWILC_WFIDrv *hWFIDrv, const u8 *pu8WepKey, strHostIFmsg.drvHandler = hWFIDrv; - strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr. - uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey = WILC_MALLOC(u8WepKeylen); + strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey = kmalloc(u8WepKeylen, + GFP_ATOMIC); memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey, pu8WepKey, u8WepKeylen); @@ -4908,8 +4926,8 @@ s32 host_int_add_wep_key_bss_ap(tstrWILC_WFIDrv *hWFIDrv, const u8 *pu8WepKey, u strHostIFmsg.drvHandler = hWFIDrv; - strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr. - uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey = WILC_MALLOC((u8WepKeylen)); + strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey = kmalloc((u8WepKeylen), + GFP_ATOMIC); memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey, @@ -4991,8 +5009,8 @@ s32 host_int_add_ptk(tstrWILC_WFIDrv *hWFIDrv, const u8 *pu8Ptk, u8 u8PtkKeylen, strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.u8KeyAction = ADDKEY; - strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr. - uniHostIFkeyAttr.strHostIFwpaAttr.pu8key = WILC_MALLOC(u8PtkKeylen); + strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwpaAttr.pu8key = kmalloc(u8PtkKeylen, + GFP_ATOMIC); memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwpaAttr.pu8key, @@ -5077,8 +5095,8 @@ s32 host_int_add_rx_gtk(tstrWILC_WFIDrv *hWFIDrv, const u8 *pu8RxGtk, u8 u8GtkKe if (pu8TxMic != NULL) u8KeyLen += TX_MIC_KEY_LEN; if (KeyRSC != NULL) { - strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr. - uniHostIFkeyAttr.strHostIFwpaAttr.pu8seq = WILC_MALLOC(u32KeyRSClen); + strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwpaAttr.pu8seq = kmalloc(u32KeyRSClen, + GFP_ATOMIC); memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwpaAttr.pu8seq, KeyRSC, u32KeyRSClen); @@ -5099,8 +5117,8 @@ s32 host_int_add_rx_gtk(tstrWILC_WFIDrv *hWFIDrv, const u8 *pu8RxGtk, u8 u8GtkKe strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.u8KeyAction = ADDKEY; - strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr. - uniHostIFkeyAttr.strHostIFwpaAttr.pu8key = WILC_MALLOC(u8KeyLen); + strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwpaAttr.pu8key = kmalloc(u8KeyLen, + GFP_ATOMIC); memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwpaAttr.pu8key, pu8RxGtk, u8GtkKeylen); @@ -5556,14 +5574,16 @@ s32 host_int_set_join_req(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8bssid, strHostIFmsg.drvHandler = hWFIDrv; if (pu8bssid != NULL) { - strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr.pu8bssid = WILC_MALLOC(6); /* will be deallocated by the receiving thread */ + strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr.pu8bssid = kmalloc(6, + GFP_ATOMIC); /* will be deallocated by the receiving thread */ memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr.pu8bssid, pu8bssid, 6); } if (pu8ssid != NULL) { strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr.ssidLen = ssidLen; - strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr.pu8ssid = WILC_MALLOC(ssidLen); /* will be deallocated by the receiving thread */ + strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr.pu8ssid = kmalloc(ssidLen, + GFP_ATOMIC); /* will be deallocated by the receiving thread */ memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr.pu8ssid, pu8ssid, ssidLen); @@ -5571,7 +5591,8 @@ s32 host_int_set_join_req(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8bssid, if (pu8IEs != NULL) { strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr.IEsLen = IEsLen; - strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr.pu8IEs = WILC_MALLOC(IEsLen); /* will be deallocated by the receiving thread */ + strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr.pu8IEs = kmalloc(IEsLen, + GFP_ATOMIC); /* will be deallocated by the receiving thread */ memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFconnectAttr.pu8IEs, pu8IEs, IEsLen); } @@ -6308,12 +6329,14 @@ s32 host_int_scan(tstrWILC_WFIDrv *hWFIDrv, u8 u8ScanSource, strHostIFmsg.uniHostIFmsgBody.strHostIFscanAttr.pvUserArg = pvUserArg; strHostIFmsg.uniHostIFmsgBody.strHostIFscanAttr.u8ChnlListLen = u8ChnlListLen; - strHostIFmsg.uniHostIFmsgBody.strHostIFscanAttr.pu8ChnlFreqList = WILC_MALLOC(u8ChnlListLen); /* will be deallocated by the receiving thread */ + strHostIFmsg.uniHostIFmsgBody.strHostIFscanAttr.pu8ChnlFreqList = kmalloc(u8ChnlListLen, + GFP_ATOMIC); /* will be deallocated by the receiving thread */ memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFscanAttr.pu8ChnlFreqList, pu8ChnlFreqList, u8ChnlListLen); strHostIFmsg.uniHostIFmsgBody.strHostIFscanAttr.IEsLen = IEsLen; - strHostIFmsg.uniHostIFmsgBody.strHostIFscanAttr.pu8IEs = WILC_MALLOC(IEsLen); /* will be deallocated by the receiving thread */ + strHostIFmsg.uniHostIFmsgBody.strHostIFscanAttr.pu8IEs = kmalloc(IEsLen, + GFP_ATOMIC); /* will be deallocated by the receiving thread */ memcpy(strHostIFmsg.uniHostIFmsgBody.strHostIFscanAttr.pu8IEs, pu8IEs, IEsLen); @@ -6593,7 +6616,7 @@ s32 host_int_init(tstrWILC_WFIDrv **phWFIDrv) /*Allocate host interface private structure*/ - pstrWFIDrv = WILC_MALLOC(sizeof(tstrWILC_WFIDrv)); + pstrWFIDrv = kmalloc(sizeof(tstrWILC_WFIDrv), GFP_ATOMIC); if (pstrWFIDrv == NULL) { /* WILC_ERRORREPORT(s32Error,WILC_NO_MEM); */ s32Error = WILC_NO_MEM; @@ -6885,7 +6908,8 @@ void NetworkInfoReceived(u8 *pu8Buffer, u32 u32Length) strHostIFmsg.drvHandler = pstrWFIDrv; strHostIFmsg.uniHostIFmsgBody.strRcvdNetworkInfo.u32Length = u32Length; - strHostIFmsg.uniHostIFmsgBody.strRcvdNetworkInfo.pu8Buffer = WILC_MALLOC(u32Length); /* will be deallocated by the receiving thread */ + strHostIFmsg.uniHostIFmsgBody.strRcvdNetworkInfo.pu8Buffer = kmalloc(u32Length, + GFP_ATOMIC); /* will be deallocated by the receiving thread */ memcpy(strHostIFmsg.uniHostIFmsgBody.strRcvdNetworkInfo.pu8Buffer, pu8Buffer, u32Length); @@ -6945,7 +6969,8 @@ void GnrlAsyncInfoReceived(u8 *pu8Buffer, u32 u32Length) strHostIFmsg.uniHostIFmsgBody.strRcvdGnrlAsyncInfo.u32Length = u32Length; - strHostIFmsg.uniHostIFmsgBody.strRcvdGnrlAsyncInfo.pu8Buffer = WILC_MALLOC(u32Length); /* will be deallocated by the receiving thread */ + strHostIFmsg.uniHostIFmsgBody.strRcvdGnrlAsyncInfo.pu8Buffer = kmalloc(u32Length, + GFP_ATOMIC); /* will be deallocated by the receiving thread */ memcpy(strHostIFmsg.uniHostIFmsgBody.strRcvdGnrlAsyncInfo.pu8Buffer, pu8Buffer, u32Length); @@ -7191,7 +7216,7 @@ s32 host_int_add_beacon(tstrWILC_WFIDrv *hWFIDrv, u32 u32Interval, pstrSetBeaconParam->u32Interval = u32Interval; pstrSetBeaconParam->u32DTIMPeriod = u32DTIMPeriod; pstrSetBeaconParam->u32HeadLen = u32HeadLen; - pstrSetBeaconParam->pu8Head = WILC_MALLOC(u32HeadLen); + pstrSetBeaconParam->pu8Head = kmalloc(u32HeadLen, GFP_ATOMIC); if (pstrSetBeaconParam->pu8Head == NULL) WILC_ERRORREPORT(s32Error, WILC_NO_MEM); memcpy(pstrSetBeaconParam->pu8Head, pu8Head, u32HeadLen); @@ -7199,7 +7224,7 @@ s32 host_int_add_beacon(tstrWILC_WFIDrv *hWFIDrv, u32 u32Interval, /* Bug 4599 : if tail length = 0 skip allocating & copying */ if (u32TailLen > 0) { - pstrSetBeaconParam->pu8Tail = WILC_MALLOC(u32TailLen); + pstrSetBeaconParam->pu8Tail = kmalloc(u32TailLen, GFP_ATOMIC); if (pstrSetBeaconParam->pu8Tail == NULL) WILC_ERRORREPORT(s32Error, WILC_NO_MEM); memcpy(pstrSetBeaconParam->pu8Tail, pu8Tail, u32TailLen); @@ -7289,7 +7314,7 @@ s32 host_int_add_station(tstrWILC_WFIDrv *hWFIDrv, tstrWILC_AddStaParam *pstrSta memcpy(pstrAddStationMsg, pstrStaParams, sizeof(tstrWILC_AddStaParam)); if (pstrAddStationMsg->u8NumRates > 0) { - u8 *rates = WILC_MALLOC(pstrAddStationMsg->u8NumRates); + u8 *rates = kmalloc(pstrAddStationMsg->u8NumRates, GFP_ATOMIC); WILC_NULLCHECK(s32Error, rates); @@ -7444,7 +7469,7 @@ s32 host_int_edit_station(tstrWILC_WFIDrv *hWFIDrv, tstrWILC_AddStaParam *pstrSt memcpy(pstrAddStationMsg, pstrStaParams, sizeof(tstrWILC_AddStaParam)); if (pstrAddStationMsg->u8NumRates > 0) { - u8 *rates = WILC_MALLOC(pstrAddStationMsg->u8NumRates); + u8 *rates = kmalloc(pstrAddStationMsg->u8NumRates, GFP_ATOMIC); WILC_NULLCHECK(s32Error, rates); memcpy(rates, pstrStaParams->pu8Rates, pstrAddStationMsg->u8NumRates); @@ -7561,7 +7586,7 @@ static void *host_int_ParseJoinBssParam(tstrNetworkInfo *ptstrNetworkInfo) pu8IEs = ptstrNetworkInfo->pu8IEs; u16IEsLen = ptstrNetworkInfo->u16IEsLen; - pNewJoinBssParam = WILC_MALLOC(sizeof(tstrJoinBssParam)); + pNewJoinBssParam = kmalloc(sizeof(tstrJoinBssParam), GFP_ATOMIC); if (pNewJoinBssParam != NULL) { memset(pNewJoinBssParam, 0, sizeof(tstrJoinBssParam)); pNewJoinBssParam->dtim_period = ptstrNetworkInfo->u8DtimPeriod; -- 2.1.0 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/