diff options
| author | krunal soni <ksoni@qca.qualcomm.com> | 2014-01-22 11:32:19 -0800 |
|---|---|---|
| committer | Prakash Dhavali <pdhavali@qca.qualcomm.com> | 2014-01-26 21:36:59 -0800 |
| commit | 79eed0c34868a342245e99cfd9eae8ef232ed015 (patch) | |
| tree | 3cdde475420dde83ab9ae28227bdd2f86baab827 | |
| parent | 8f4cce2860327f24801a4ff05b60b2475c852880 (diff) | |
wlan: Fix for Statis analysis errors in SME module
It will fix all critical errors reported in SME
module by statis analysis tool.
Change-Id: Iffc6fe4a6d8b8ab4ff4791a8adb7102d3caa5edd
CRs-Fixed: 602033
| -rw-r--r-- | CORE/SME/src/csr/csrApiRoam.c | 66 | ||||
| -rw-r--r-- | CORE/SME/src/csr/csrApiScan.c | 7 | ||||
| -rw-r--r-- | CORE/SME/src/csr/csrNeighborRoam.c | 11 | ||||
| -rw-r--r-- | CORE/SME/src/csr/csrTdlsProcess.c | 23 | ||||
| -rw-r--r-- | CORE/SME/src/pmc/pmcApi.c | 6 | ||||
| -rw-r--r-- | CORE/SME/src/sme_common/sme_Api.c | 24 |
6 files changed, 99 insertions, 38 deletions
diff --git a/CORE/SME/src/csr/csrApiRoam.c b/CORE/SME/src/csr/csrApiRoam.c index b5d103c25cd9..2c4b7559dafa 100644 --- a/CORE/SME/src/csr/csrApiRoam.c +++ b/CORE/SME/src/csr/csrApiRoam.c @@ -2433,9 +2433,20 @@ eHalStatus csrRoamCallCallback(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoam return eHAL_STATUS_FAILURE; } + if (eANI_BOOLEAN_FALSE == pSession->sessionActive) + { + smsLog(pMac, LOG1, "%s Session is not Active", __func__); + return eHAL_STATUS_FAILURE; + } + if (NULL == pRoamInfo) + { + smsLog(pMac, LOGE, "%s: pRoamInfo is NULL", __func__); + VOS_ASSERT(0); + return eHAL_STATUS_FAILURE; + } smsLog(pMac, LOG4, "Recieved RoamCmdStatus %d with Roam Result %d", u1, u2); - if(eCSR_ROAM_ASSOCIATION_COMPLETION == u1 && pRoamInfo) + if(eCSR_ROAM_ASSOCIATION_COMPLETION == u1) { smsLog(pMac, LOGW, " Assoc complete result = %d statusCode = %d reasonCode = %d", u2, pRoamInfo->statusCode, pRoamInfo->reasonCode); } @@ -2453,13 +2464,6 @@ eHalStatus csrRoamCallCallback(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoam pSession->bRefAssocStartCnt--; } - if ( (pSession == NULL) || - (eANI_BOOLEAN_FALSE == pSession->sessionActive) ) - { - smsLog(pMac, LOG1, "Session ID is not valid"); - return eHAL_STATUS_FAILURE; - } - if(NULL != pSession->callback) { if( pRoamInfo ) @@ -5945,8 +5949,6 @@ static tANI_BOOLEAN csrRoamProcessResults( tpAniSirGlobal pMac, tSmeCmd *pComman if( CSR_IS_SESSION_VALID(pMac, sessionId) ) { pSession = CSR_GET_SESSION(pMac, sessionId); - if (!pSession) - break; if ( CSR_IS_INFRA_AP(&pSession->connectedProfile) ) { @@ -9205,10 +9207,12 @@ void csrRoamCheckForLinkStatusChange( tpAniSirGlobal pMac, tSirSmeRsp *pSirMsg ) tpSirSmeSwitchChannelInd pSwitchChnInd; tSmeMaxAssocInd *pSmeMaxAssocInd; tSmeCmd pCommand; - pSirMsg->messageType = (pSirMsg->messageType); - pSirMsg->length = (pSirMsg->length); - pSirMsg->statusCode = (pSirMsg->statusCode); vos_mem_set(&roamInfo, sizeof(roamInfo), 0); + + if (NULL == pSirMsg) + { smsLog(pMac, LOGE, FL("pSirMsg is NULL")); + return; + } switch( pSirMsg->messageType ) { case eWNI_SME_ASSOC_IND: @@ -9470,11 +9474,6 @@ void csrRoamCheckForLinkStatusChange( tpAniSirGlobal pMac, tSirSmeRsp *pSirMsg ) if( CSR_IS_SESSION_VALID(pMac, sessionId) ) { pSession = CSR_GET_SESSION(pMac, sessionId); - if(!pSession) - { - smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); - return; - } if ( CSR_IS_INFRA_AP(&pSession->connectedProfile) ) { pRoamInfo = &roamInfo; @@ -9498,11 +9497,6 @@ void csrRoamCheckForLinkStatusChange( tpAniSirGlobal pMac, tSirSmeRsp *pSirMsg ) if( CSR_IS_SESSION_VALID(pMac, sessionId) ) { pSession = CSR_GET_SESSION(pMac, sessionId); - if(!pSession) - { - smsLog(pMac, LOGE, FL(" session %d not found "), sessionId); - return; - } if ( CSR_IS_INFRA_AP(&pSession->connectedProfile) ) { pRoamInfo = &roamInfo; @@ -9871,16 +9865,11 @@ void csrRoamCheckForLinkStatusChange( tpAniSirGlobal pMac, tSirSmeRsp *pSirMsg ) } #endif //FEATURE_WLAN_DIAG_SUPPORT_CSR smsLog(pMac, LOGW, "CSR: Peer departed notification from LIM"); - if(pIbssPeerInd) - { - roamInfo.staId = (tANI_U8)pIbssPeerInd->staId; - roamInfo.ucastSig = (tANI_U8)pIbssPeerInd->ucastSig; - roamInfo.bcastSig = (tANI_U8)pIbssPeerInd->bcastSig; - vos_mem_copy(&roamInfo.peerMac, pIbssPeerInd->peerAddr, - sizeof(tCsrBssid)); - } - else - smsLog(pMac, LOGE, "CSR: departed peer info is NULL"); + roamInfo.staId = (tANI_U8)pIbssPeerInd->staId; + roamInfo.ucastSig = (tANI_U8)pIbssPeerInd->ucastSig; + roamInfo.bcastSig = (tANI_U8)pIbssPeerInd->bcastSig; + vos_mem_copy(&roamInfo.peerMac, pIbssPeerInd->peerAddr, + sizeof(tCsrBssid)); csrRoamCallCallback(pMac, sessionId, &roamInfo, 0, eCSR_ROAM_CONNECT_STATUS_UPDATE, eCSR_ROAM_RESULT_IBSS_PEER_DEPARTED); } @@ -11358,7 +11347,10 @@ tANI_U8 csrRoamGetIbssStartChannelNumber50( tpAniSirGlobal pMac ) { if ( CSR_IS_CHANNEL_5GHZ(pMac->roam.validChannelList[ idxValidChannels ]) ) // the max channel# in 11g is 14 { - channel = csrStartIbssChannels50[ idxValidChannels ]; + if (idxValidChannels < CSR_NUM_IBSS_START_CHANNELS_50) + { + channel = csrStartIbssChannels50[ idxValidChannels ]; + } break; } } @@ -15814,6 +15806,12 @@ eHalStatus csrRoamOffloadScan(tpAniSirGlobal pMac, tANI_U8 command, tANI_U8 reas return eHAL_STATUS_FAILURE; } pSession = CSR_GET_SESSION( pMac, sessionId ); + if (NULL == pSession) + { + VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, + "%s:pSession is null", __func__); + return eHAL_STATUS_FAILURE; + } pRequestBuf = vos_mem_malloc(sizeof(tSirRoamOffloadScanReq)); if (NULL == pRequestBuf) { diff --git a/CORE/SME/src/csr/csrApiScan.c b/CORE/SME/src/csr/csrApiScan.c index 4a4a68dd2409..cd538fecfeb8 100644 --- a/CORE/SME/src/csr/csrApiScan.c +++ b/CORE/SME/src/csr/csrApiScan.c @@ -7257,10 +7257,13 @@ eHalStatus csrScanForSSID(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfi vos_mem_set(&pScanCmd->u.scanCmd, sizeof(tScanCmd), 0); pScanCmd->u.scanCmd.pToRoamProfile = vos_mem_malloc(sizeof(tCsrRoamProfile)); if ( NULL == pScanCmd->u.scanCmd.pToRoamProfile ) + { status = eHAL_STATUS_FAILURE; + } else - status = eHAL_STATUS_SUCCESS; - status = csrRoamCopyProfile(pMac, pScanCmd->u.scanCmd.pToRoamProfile, pProfile); + { + status = csrRoamCopyProfile(pMac, pScanCmd->u.scanCmd.pToRoamProfile, pProfile); + } if(!HAL_STATUS_SUCCESS(status)) break; pScanCmd->u.scanCmd.roamId = roamId; diff --git a/CORE/SME/src/csr/csrNeighborRoam.c b/CORE/SME/src/csr/csrNeighborRoam.c index b2c91819dac9..bbcc8d7730fc 100644 --- a/CORE/SME/src/csr/csrNeighborRoam.c +++ b/CORE/SME/src/csr/csrNeighborRoam.c @@ -3935,6 +3935,11 @@ eHalStatus csrNeighborRoamIndicateDisconnect(tpAniSirGlobal pMac, tANI_U8 sessio #endif tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId); + if (NULL == pSession) + { + smsLog(pMac, LOGE, FL("pSession is NULL ")); + return eHAL_STATUS_FAILURE; + } smsLog(pMac, LOGE, FL("Disconnect indication on session %d in state %d from BSSID : " MAC_ADDRESS_STR), sessionId, pNeighborRoamInfo->neighborRoamState, MAC_ADDR_ARRAY(pSession->connectedProfile.bssid)); @@ -4863,6 +4868,12 @@ eHalStatus csrNeighborRoamProcessHandoffReq(tpAniSirGlobal pMac) tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, pNeighborRoamInfo->csrSessionId ); tANI_U8 i = 0; + if (NULL == pSession) + { + smsLog(pMac, LOGE, FL("pSession is NULL ")); + return eHAL_STATUS_FAILURE; + } + do { roamId = GET_NEXT_ROAM_ID(&pMac->roam); diff --git a/CORE/SME/src/csr/csrTdlsProcess.c b/CORE/SME/src/csr/csrTdlsProcess.c index c41e836538c9..adf472e724e1 100644 --- a/CORE/SME/src/csr/csrTdlsProcess.c +++ b/CORE/SME/src/csr/csrTdlsProcess.c @@ -469,6 +469,11 @@ eHalStatus csrTdlsProcessSendMgmt( tpAniSirGlobal pMac, tSmeCmd *cmd ) tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, cmd->sessionId ); eHalStatus status = eHAL_STATUS_FAILURE; + if (NULL == pSession) + { + smsLog( pMac, LOGE, FL("pSession is NULL")); + return eHAL_STATUS_FAILURE; + } if (NULL == pSession->pConnectBssDesc) { smsLog( pMac, LOGE, FL("BSS Description is not present") ); @@ -533,6 +538,12 @@ eHalStatus csrTdlsProcessAddSta( tpAniSirGlobal pMac, tSmeCmd *cmd ) tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, cmd->sessionId ); eHalStatus status = eHAL_STATUS_FAILURE; + if (NULL == pSession) + { + smsLog( pMac, LOGE, FL("pSession is NULL")); + return eHAL_STATUS_FAILURE; + } + if (NULL == pSession->pConnectBssDesc) { smsLog( pMac, LOGE, FL("BSS description is not present") ); @@ -597,6 +608,12 @@ eHalStatus csrTdlsProcessDelSta( tpAniSirGlobal pMac, tSmeCmd *cmd ) tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, cmd->sessionId ); eHalStatus status = eHAL_STATUS_FAILURE; + if (NULL == pSession) + { + smsLog( pMac, LOGE, FL("pSession is NULL")); + return eHAL_STATUS_FAILURE; + } + if (NULL == pSession->pConnectBssDesc) { smsLog( pMac, LOGE, FL("BSS description is not present") ); @@ -824,6 +841,12 @@ eHalStatus csrTdlsProcessLinkEstablish( tpAniSirGlobal pMac, tSmeCmd *cmd ) eHalStatus status = eHAL_STATUS_FAILURE; tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, cmd->sessionId ); + if (NULL == pSession) + { + smsLog( pMac, LOGE, FL("pSession is NULL")); + return eHAL_STATUS_FAILURE; + } + tdlsLinkEstablishReq = vos_mem_malloc(sizeof(tSirTdlsLinkEstablishReq)); if (tdlsLinkEstablishReq == NULL) diff --git a/CORE/SME/src/pmc/pmcApi.c b/CORE/SME/src/pmc/pmcApi.c index 0a4b4ceff7bf..988853d00a1c 100644 --- a/CORE/SME/src/pmc/pmcApi.c +++ b/CORE/SME/src/pmc/pmcApi.c @@ -2912,6 +2912,12 @@ eHalStatus pmcSetPreferredNetworkList tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); tANI_U8 ucDot11Mode; + if (NULL == pSession) + { + VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, + "%s: pSession is NULL", __func__); + return eHAL_STATUS_FAILURE; + } VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s: SSID = 0x%08x%08x%08x%08x%08x%08x%08x%08x, " "0x%08x%08x%08x%08x%08x%08x%08x%08x", __func__, diff --git a/CORE/SME/src/sme_common/sme_Api.c b/CORE/SME/src/sme_common/sme_Api.c index 6b1b6f6d1ba9..d93f7a228829 100644 --- a/CORE/SME/src/sme_common/sme_Api.c +++ b/CORE/SME/src/sme_common/sme_Api.c @@ -9576,7 +9576,7 @@ eHalStatus sme_ChangeRoamScanChannelList(tHalHandle hHal, tANI_U8 *pChannelList, eHalStatus status = eHAL_STATUS_SUCCESS; tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; tANI_U8 oldChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN*2] = {0}; - tANI_U8 newChannelList[128] = {0}; + tANI_U8 newChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN*2] = {0}; tANI_U8 i = 0, j = 0; status = sme_AcquireGlobalLock( &pMac->sme ); @@ -10566,7 +10566,8 @@ void smeGetCommandQStatus( tHalHandle hHal ) if (NULL == pMac) { - smsLog( pMac, LOGE, "smeGetCommandQStatus: pMac is NULL" ); + VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, + "%s: pMac is NULL", __func__); return; } @@ -10705,6 +10706,12 @@ VOS_STATUS sme_SetIdlePowersaveConfig(v_PVOID_t vosContext, tANI_U32 value) { v_PVOID_t wdaContext = vos_get_context(VOS_MODULE_ID_WDA, vosContext); + if (NULL == wdaContext) + { + VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, + "%s: wdaContext is NULL", __func__); + return VOS_STATUS_E_FAILURE; + } VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG, " Idle Ps Set Value %d", value); @@ -10808,6 +10815,12 @@ tANI_S16 sme_GetHTConfig(tHalHandle hHal, tANI_U8 session_id, tANI_U16 ht_capab) tpAniSirGlobal pMac = PMAC_STRUCT(hHal); tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, session_id); + if (NULL == pSession) + { + VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, + "%s: pSession is NULL", __func__); + return -EIO; + } switch (ht_capab) { case WNI_CFG_HT_CAP_INFO_ADVANCE_CODING: return pSession->htConfig.ht_rx_ldpc; @@ -10831,6 +10844,13 @@ int sme_UpdateHTConfig(tHalHandle hHal, tANI_U8 sessionId, tANI_U16 htCapab, tpAniSirGlobal pMac = PMAC_STRUCT(hHal); tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId); + if (NULL == pSession) + { + VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, + "%s: pSession is NULL", __func__); + return -EIO; + } + if (eHAL_STATUS_SUCCESS != WDA_SetHTConfig(sessionId, htCapab, value)) { VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "Failed to set ht capability in target"); |
