diff options
| author | Srinivas Girigowda <sgirigow@qca.qualcomm.com> | 2014-07-28 16:03:07 -0700 |
|---|---|---|
| committer | Pitani Venkata Rajesh Kumar <c_vpitan@qti.qualcomm.com> | 2014-08-01 19:53:58 +0530 |
| commit | c6e420d6f519f462bc45ebdc16a2cb5348f8c7ee (patch) | |
| tree | 74bcd9066a773b9b1190aff4546247e6d69b5599 | |
| parent | a073455975534f3e37443b759615eebd8c7c3675 (diff) | |
qcacld: UMAC: Fix issues reported by static analysis tool
Fix issues reported by static analysis tool
Change-Id: Ia65a45b9a1c53b0af6d73602f59061fc0ca27f64
CRs-Fixed: 700953
| -rw-r--r-- | CORE/MAC/src/pe/lim/limFT.c | 53 | ||||
| -rw-r--r-- | CORE/SME/src/csr/csrApiRoam.c | 14 | ||||
| -rw-r--r-- | CORE/SME/src/sme_common/sme_FTApi.c | 110 |
3 files changed, 90 insertions, 87 deletions
diff --git a/CORE/MAC/src/pe/lim/limFT.c b/CORE/MAC/src/pe/lim/limFT.c index b9cee3f4a1b8..7a9d4047911f 100644 --- a/CORE/MAC/src/pe/lim/limFT.c +++ b/CORE/MAC/src/pe/lim/limFT.c @@ -78,13 +78,6 @@ void limFTCleanupPreAuthInfo(tpAniSirGlobal pMac, tpPESession psessionEntry) tpPESession pReAssocSessionEntry = NULL; tANI_U8 sessionId = 0; - if (!pMac) { -#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG - PELOGE(limLog(pMac, LOGE, "%s: pMac is NULL", __func__);) -#endif - return; - } - if (!psessionEntry) { #if defined WLAN_FEATURE_VOWIFI_11R_DEBUG PELOGE(limLog(pMac, LOGE, "%s: psessionEntry is NULL", __func__);) @@ -346,7 +339,12 @@ void limPerformFTPreAuth(tpAniSirGlobal pMac, eHalStatus status, { tSirMacAuthFrameBody authFrame; - if (psessionEntry && psessionEntry->is11Rconnection && + if (NULL == psessionEntry) { + PELOGE(limLog(pMac, LOGE, FL("psessionEntry is NULL"));) + return; + } + + if (psessionEntry->is11Rconnection && psessionEntry->ftPEContext.pFTPreAuthReq) { /* Only 11r assoc has FT IEs */ if (psessionEntry->ftPEContext.pFTPreAuthReq->ft_ies == NULL) { @@ -1054,8 +1052,8 @@ void limFTProcessPreAuthResult(tpAniSirGlobal pMac, eHalStatus status, { tpPESession psessionEntry = (tpPESession)data; - if (NULL == psessionEntry && - NULL == psessionEntry->ftPEContext.pFTPreAuthReq) + if (NULL == psessionEntry || + NULL == psessionEntry->ftPEContext.pFTPreAuthReq) return; /* Nothing to be done if the session is not in STA mode */ @@ -1117,24 +1115,25 @@ void limPostFTPreAuthRsp(tpAniSirGlobal pMac, tSirRetStatus status, PELOGE(limLog( pMac, LOG1, FL("Auth Rsp = %p"), pFTPreAuthRsp);) #endif - /* Nothing to be done if the session is not in STA mode */ - if (eLIM_STA_ROLE != psessionEntry->limSystemRole) { + if (psessionEntry) { + /* Nothing to be done if the session is not in STA mode */ + if (eLIM_STA_ROLE != psessionEntry->limSystemRole) { #if defined WLAN_FEATURE_VOWIFI_11R_DEBUG - PELOGE(limLog(pMac, LOGE, FL("psessionEntry is not in STA mode"));) + PELOGE(limLog(pMac, LOGE, FL("psessionEntry is not in STA mode"));) #endif - return; + return; + } + pFTPreAuthRsp->smeSessionId = psessionEntry->smeSessionId; + + /* The bssid of the AP we are sending Auth1 to. */ + if (psessionEntry->ftPEContext.pFTPreAuthReq) + sirCopyMacAddr(pFTPreAuthRsp->preAuthbssId, + psessionEntry->ftPEContext.pFTPreAuthReq->preAuthbssId); } pFTPreAuthRsp->messageType = eWNI_SME_FT_PRE_AUTH_RSP; pFTPreAuthRsp->length = (tANI_U16) rspLen; pFTPreAuthRsp->status = status; - if (psessionEntry) - pFTPreAuthRsp->smeSessionId = psessionEntry->smeSessionId; - - /* The bssid of the AP we are sending Auth1 to. */ - if (psessionEntry->ftPEContext.pFTPreAuthReq) - sirCopyMacAddr(pFTPreAuthRsp->preAuthbssId, - psessionEntry->ftPEContext.pFTPreAuthReq->preAuthbssId); /* Attach the auth response now back to SME */ pFTPreAuthRsp->ft_ies_length = 0; @@ -1174,7 +1173,6 @@ void limHandleFTPreAuthRsp(tpAniSirGlobal pMac, tSirRetStatus status, tANI_U8 *auth_rsp, tANI_U16 auth_rsp_length, tpPESession psessionEntry) { - tpPESession pftSessionEntry = NULL; tANI_U8 sessionId = 0; tpSirBssDescription pbssDescription = NULL; @@ -1205,10 +1203,15 @@ void limHandleFTPreAuthRsp(tpAniSirGlobal pMac, tSirRetStatus status, auth_rsp_length; } + if (!psessionEntry->ftPEContext.pFTPreAuthReq || + !psessionEntry->ftPEContext.pFTPreAuthReq->pbssDescription) { + limLog(pMac, LOGE, + FL("pFTPreAuthReq or pbssDescription is NULL")); + return; + } + /* Create FT session for the re-association at this point */ - if (psessionEntry->ftPEContext.ftPreAuthStatus == eSIR_SUCCESS && - psessionEntry->ftPEContext.pFTPreAuthReq && - psessionEntry->ftPEContext.pFTPreAuthReq->pbssDescription) { + if (psessionEntry->ftPEContext.ftPreAuthStatus == eSIR_SUCCESS) { pbssDescription = psessionEntry->ftPEContext.pFTPreAuthReq->pbssDescription; limPrintMacAddr(pMac, pbssDescription->bssId, LOG1); diff --git a/CORE/SME/src/csr/csrApiRoam.c b/CORE/SME/src/csr/csrApiRoam.c index 78442566ab3f..ac4717621ff4 100644 --- a/CORE/SME/src/csr/csrApiRoam.c +++ b/CORE/SME/src/csr/csrApiRoam.c @@ -17756,13 +17756,21 @@ eHalStatus csrRoamUpdateWPARSNIEs( tpAniSirGlobal pMac, tANI_U32 sessionId, tSir } #ifdef WLAN_FEATURE_VOWIFI_11R -//eHalStatus csrRoamIssueFTPreauthReq(tHalHandle hHal, tANI_U32 sessionId, tCsrBssid preAuthBssid, tANI_U8 channelId) -eHalStatus csrRoamIssueFTPreauthReq(tHalHandle hHal, tANI_U32 sessionId, tpSirBssDescription pBssDescription) +eHalStatus +csrRoamIssueFTPreauthReq(tHalHandle hHal, tANI_U32 sessionId, + tpSirBssDescription pBssDescription) { tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); tpSirFTPreAuthReq pftPreAuthReq; tANI_U16 auth_req_len = 0; - tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); + tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId); + + if (NULL == pSession) { + smsLog(pMac, LOGE, + FL("Session does not exist for session id(%d)"), sessionId); + return eHAL_STATUS_FAILURE; + } + auth_req_len = sizeof(tSirFTPreAuthReq); pftPreAuthReq = (tpSirFTPreAuthReq)vos_mem_malloc(auth_req_len); if (NULL == pftPreAuthReq) diff --git a/CORE/SME/src/sme_common/sme_FTApi.c b/CORE/SME/src/sme_common/sme_FTApi.c index 2ce4e02d9f9a..814e9c0ee653 100644 --- a/CORE/SME/src/sme_common/sme_FTApi.c +++ b/CORE/SME/src/sme_common/sme_FTApi.c @@ -46,39 +46,34 @@ void sme_FTOpen(tHalHandle hHal, tANI_U32 sessionId) { tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); eHalStatus status = eHAL_STATUS_SUCCESS; - tCsrRoamSession *pSession = NULL; + tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId); - if (CSR_IS_SESSION_VALID(pMac, sessionId)) - { - /* Clear existing context data if any */ - pSession = CSR_GET_SESSION( pMac, sessionId ); - if (NULL != pSession) { - /* Clean up the context */ - vos_mem_set(&pSession->ftSmeContext, sizeof(tftSMEContext), 0); - - pSession->ftSmeContext.pUsrCtx = vos_mem_malloc( - sizeof(tFTRoamCallbackUsrCtx)); - - if (NULL == pSession->ftSmeContext.pUsrCtx) { - smsLog(pMac, LOGE, FL("Memory allocation failure")); - return; - } - pSession->ftSmeContext.pUsrCtx->pMac = pMac; - pSession->ftSmeContext.pUsrCtx->sessionId = sessionId; - - status = - vos_timer_init(&pSession->ftSmeContext.preAuthReassocIntvlTimer, - VOS_TIMER_TYPE_SW, - sme_PreauthReassocIntvlTimerCallback, - (void *)pSession->ftSmeContext.pUsrCtx); - - if (eHAL_STATUS_SUCCESS != status) { - smsLog(pMac, LOGE, - FL("Preauth Reassoc interval Timer allocation failed")); - vos_mem_free(pSession->ftSmeContext.pUsrCtx); - pSession->ftSmeContext.pUsrCtx = NULL; - return; - } + if (NULL != pSession) { + /* Clean up the context */ + vos_mem_set(&pSession->ftSmeContext, sizeof(tftSMEContext), 0); + + pSession->ftSmeContext.pUsrCtx = vos_mem_malloc( + sizeof(tFTRoamCallbackUsrCtx)); + + if (NULL == pSession->ftSmeContext.pUsrCtx) { + smsLog(pMac, LOGE, FL("Memory allocation failure")); + return; + } + pSession->ftSmeContext.pUsrCtx->pMac = pMac; + pSession->ftSmeContext.pUsrCtx->sessionId = sessionId; + + status = + vos_timer_init(&pSession->ftSmeContext.preAuthReassocIntvlTimer, + VOS_TIMER_TYPE_SW, + sme_PreauthReassocIntvlTimerCallback, + (void *)pSession->ftSmeContext.pUsrCtx); + + if (eHAL_STATUS_SUCCESS != status) { + smsLog(pMac, LOGE, + FL("Preauth Reassoc interval Timer allocation failed")); + vos_mem_free(pSession->ftSmeContext.pUsrCtx); + pSession->ftSmeContext.pUsrCtx = NULL; + return; } } } @@ -356,12 +351,11 @@ eHalStatus sme_FTSendUpdateKeyInd(tHalHandle hHal, tANI_U32 sessionId, v_BOOL_t sme_GetFTPTKState(tHalHandle hHal, tANI_U32 sessionId) { - tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); - tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); + tpAniSirGlobal pMac = PMAC_STRUCT(hHal); + tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId); - if (!pSession) - { - smsLog( pMac, LOGE, FL("pSession is NULL")); + if (!pSession) { + smsLog(pMac, LOGE, FL("pSession is NULL")); return VOS_FALSE; } return pSession->ftSmeContext.setFTPTKState; @@ -369,8 +363,13 @@ v_BOOL_t sme_GetFTPTKState(tHalHandle hHal, tANI_U32 sessionId) void sme_SetFTPTKState(tHalHandle hHal, tANI_U32 sessionId, v_BOOL_t state) { - tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); - tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); + tpAniSirGlobal pMac = PMAC_STRUCT(hHal); + tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId); + + if (!pSession) { + smsLog(pMac, LOGE, FL("pSession is NULL")); + return; + } pSession->ftSmeContext.setFTPTKState = state; } @@ -571,23 +570,19 @@ void sme_PreauthReassocIntvlTimerCallback(void *context) ------------------------------------------------------------------------*/ void sme_FTReset(tHalHandle hHal, tANI_U32 sessionId) { - tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); + tpAniSirGlobal pMac = PMAC_STRUCT(hHal); tCsrRoamSession *pSession = NULL; - if (pMac == NULL) - { + if (pMac == NULL) { VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, FL("pMac is NULL")); return; } - pSession = CSR_GET_SESSION( pMac, sessionId ); + pSession = CSR_GET_SESSION(pMac, sessionId); if (NULL != pSession) { - - if (pSession->ftSmeContext.auth_ft_ies != NULL) - { - + if (pSession->ftSmeContext.auth_ft_ies != NULL) { #if defined WLAN_FEATURE_VOWIFI_11R_DEBUG - smsLog( pMac, LOG1, FL(" Freeing FT Auth IE %p and setting to NULL"), + smsLog(pMac, LOG1, FL("Freeing FT Auth IE %p and setting to NULL"), pSession->ftSmeContext.auth_ft_ies); #endif vos_mem_free(pSession->ftSmeContext.auth_ft_ies); @@ -595,11 +590,10 @@ void sme_FTReset(tHalHandle hHal, tANI_U32 sessionId) } pSession->ftSmeContext.auth_ft_ies_length = 0; - if (pSession->ftSmeContext.reassoc_ft_ies != NULL) - { + if (pSession->ftSmeContext.reassoc_ft_ies != NULL) { #if defined WLAN_FEATURE_VOWIFI_11R_DEBUG smsLog(pMac, LOG1, - FL(" Freeing FT Reassoc IE %p and setting to NULL"), + FL("Freeing FT Reassoc IE %p and setting to NULL"), pSession->ftSmeContext.reassoc_ft_ies); #endif vos_mem_free(pSession->ftSmeContext.reassoc_ft_ies); @@ -607,23 +601,21 @@ void sme_FTReset(tHalHandle hHal, tANI_U32 sessionId) } pSession->ftSmeContext.reassoc_ft_ies_length = 0; - if (pSession->ftSmeContext.psavedFTPreAuthRsp != NULL) - { + if (pSession->ftSmeContext.psavedFTPreAuthRsp != NULL) { #if defined WLAN_FEATURE_VOWIFI_11R_DEBUG smsLog( pMac, LOG1, FL("Freeing FtPreAuthRsp %p and setting to NULL"), pSession->ftSmeContext.psavedFTPreAuthRsp); #endif - vos_mem_free(pSession->ftSmeContext.psavedFTPreAuthRsp); + vos_mem_free(pSession->ftSmeContext.psavedFTPreAuthRsp); vos_mem_set(pSession->ftSmeContext.psavedFTPreAuthRsp, sizeof(tSirFTPreAuthRsp), 0); } - pSession->ftSmeContext.setFTPreAuthState = VOS_FALSE; - pSession->ftSmeContext.setFTPTKState = VOS_FALSE; - - vos_mem_zero(pSession->ftSmeContext.preAuthbssId, ANI_MAC_ADDR_SIZE); - } + pSession->ftSmeContext.setFTPreAuthState = VOS_FALSE; + pSession->ftSmeContext.setFTPTKState = VOS_FALSE; + vos_mem_zero(pSession->ftSmeContext.preAuthbssId, ANI_MAC_ADDR_SIZE); pSession->ftSmeContext.FTState = eFT_START_READY; + } } /* End of File */ |
