diff options
| author | Kiran Kumar Lokere <klokere@qca.qualcomm.com> | 2014-08-04 16:00:44 -0700 |
|---|---|---|
| committer | Pitani Venkata Rajesh Kumar <c_vpitan@qti.qualcomm.com> | 2014-08-06 13:37:06 +0530 |
| commit | af4d22df62cdde1a9f6a9470525d3367d6304096 (patch) | |
| tree | 211e1765c189a97c7cfbe8f1399836602cb44e74 | |
| parent | 3be2968a1be0ade1b120186ff6d7dc62a5f7ea6a (diff) | |
qcacld: Fix issues observed in static code analysis.
Fix issues observed in static code analysis.
Change-Id: I7bb30b9c791826fd02d05c8edbde2507ca813d96
CRs-Fixed: 704236
| -rw-r--r-- | CORE/HDD/src/wlan_hdd_assoc.c | 5 | ||||
| -rw-r--r-- | CORE/SERVICES/WMA/wma.c | 3 | ||||
| -rw-r--r-- | CORE/SME/inc/csrInternal.h | 6 | ||||
| -rw-r--r-- | CORE/SME/inc/sme_Api.h | 42 | ||||
| -rw-r--r-- | CORE/SME/src/ccm/ccmApi.c | 15 | ||||
| -rw-r--r-- | CORE/SME/src/csr/csrApiRoam.c | 66 | ||||
| -rw-r--r-- | CORE/SME/src/sme_common/sme_Api.c | 82 |
7 files changed, 21 insertions, 198 deletions
diff --git a/CORE/HDD/src/wlan_hdd_assoc.c b/CORE/HDD/src/wlan_hdd_assoc.c index 4da1261cd401..c845ed746462 100644 --- a/CORE/HDD/src/wlan_hdd_assoc.c +++ b/CORE/HDD/src/wlan_hdd_assoc.c @@ -1398,6 +1398,11 @@ static eHalStatus hdd_AssociationCompletionHandler( hdd_adapter_t *pAdapter, tCs if ( eCSR_ROAM_RESULT_ASSOCIATED == roamResult ) { + if (NULL == pRoamInfo) { + VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, + FL("pRoamInfo is NULL")); + return eHAL_STATUS_FAILURE; + } if ( !hddDisconInProgress ) { VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, diff --git a/CORE/SERVICES/WMA/wma.c b/CORE/SERVICES/WMA/wma.c index ad7f01c9fa75..4e45694c7367 100644 --- a/CORE/SERVICES/WMA/wma.c +++ b/CORE/SERVICES/WMA/wma.c @@ -25995,12 +25995,13 @@ void wma_process_roam_synch_complete(WMA_HANDLE handle, u_int16_t len; len = sizeof(wmi_roam_synch_complete_fixed_param); - wma_handle->interfaces[synchcnf->sessionId].roam_synch_in_progress = VOS_FALSE; if (!wma_handle || !wma_handle->wmi_handle) { WMA_LOGE("%s: WMA is closed, can not issue roam synch cnf", __func__); return; } + wma_handle->interfaces[synchcnf->sessionId].roam_synch_in_progress = + VOS_FALSE; wmi_buf = wmi_buf_alloc(wma_handle->wmi_handle, len); if (!wmi_buf) { WMA_LOGE("%s: wmai_buf_alloc failed", __func__); diff --git a/CORE/SME/inc/csrInternal.h b/CORE/SME/inc/csrInternal.h index 44036818851c..7bb111095c89 100644 --- a/CORE/SME/inc/csrInternal.h +++ b/CORE/SME/inc/csrInternal.h @@ -1436,15 +1436,9 @@ eHalStatus csrStop(tpAniSirGlobal pMac, tHalStopType stopType); eHalStatus csrReady(tpAniSirGlobal pMac); #ifdef FEATURE_WLAN_WAPI -eHalStatus csrRoamGetBKIDCache(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 *pNum, - tBkidCacheInfo *pBkidCache); - eHalStatus csrScanGetBKIDCandidateList(tpAniSirGlobal pMac, tANI_U32 sessionId, tBkidCandidateInfo *pBkidList, tANI_U32 *pNumItems ); -tANI_U32 csrRoamGetNumBKIDCache(tpAniSirGlobal pMac, tANI_U32 sessionId); -eHalStatus csrRoamSetBKIDCache( tpAniSirGlobal pMac, tANI_U32 sessionId, tBkidCacheInfo *pBKIDCache, - tANI_U32 numItems ); /* --------------------------------------------------------------------------- \fn csrRoamGetWapiReqIE \brief return the WAPI IE CSR passes to PE to JOIN request or START_BSS request diff --git a/CORE/SME/inc/sme_Api.h b/CORE/SME/inc/sme_Api.h index b7bc0127a5c3..7570188e4fae 100644 --- a/CORE/SME/inc/sme_Api.h +++ b/CORE/SME/inc/sme_Api.h @@ -1864,48 +1864,6 @@ eHalStatus sme_RoamRegisterCallback(tHalHandle hHal, #ifdef FEATURE_WLAN_WAPI /* --------------------------------------------------------------------------- - \fn sme_RoamSetBKIDCache - \brief The SME API exposed to HDD to allow HDD to provde SME the BKID - candidate list. - \param hHal - Handle to the HAL. The HAL handle is returned by the HAL after - it is opened (by calling halOpen). - \param pBKIDCache - caller allocated buffer point to an array of tBkidCacheInfo - \param numItems - a variable that has the number of tBkidCacheInfo allocated - when retruning, this is the number of items put into pBKIDCache - \return eHalStatus - when fail, it usually means the buffer allocated is not - big enough and pNumItems has the number of tBkidCacheInfo. - ---------------------------------------------------------------------------*/ -eHalStatus sme_RoamSetBKIDCache( tHalHandle hHal, tANI_U32 sessionId, tBkidCacheInfo *pBKIDCache, - tANI_U32 numItems ); - -/* --------------------------------------------------------------------------- - \fn sme_RoamGetBKIDCache - \brief The SME API exposed to HDD to allow HDD to request SME to return its - BKID cache. - \param hHal - Handle to the HAL. The HAL handle is returned by the HAL after - it is opened (by calling halOpen). - \param pNum - caller allocated memory that has the space of the number of - tBkidCacheInfo as input. Upon returned, *pNum has the needed number of entries - in SME cache. - \param pBkidCache - Caller allocated memory that contains BKID cache, if any, - upon return - \return eHalStatus - when fail, it usually means the buffer allocated is not - big enough. - ---------------------------------------------------------------------------*/ -eHalStatus sme_RoamGetBKIDCache(tHalHandle hHal, tANI_U32 *pNum, - tBkidCacheInfo *pBkidCache); - -/* --------------------------------------------------------------------------- - \fn sme_RoamGetNumBKIDCache - \brief The SME API exposed to HDD to allow HDD to request SME to return the - number of BKID cache entries. - \param hHal - Handle to the HAL. The HAL handle is returned by the HAL after - it is opened (by calling halOpen). - \return tANI_U32 - the number of BKID cache entries. - ---------------------------------------------------------------------------*/ -tANI_U32 sme_RoamGetNumBKIDCache(tHalHandle hHal, tANI_U32 sessionId); - -/* --------------------------------------------------------------------------- \fn sme_ScanGetBKIDCandidateList \brief a wrapper function to return the BKID candidate list \param pBkidList - caller allocated buffer point to an array of diff --git a/CORE/SME/src/ccm/ccmApi.c b/CORE/SME/src/ccm/ccmApi.c index c37605bdc7d8..7f6648a83a71 100644 --- a/CORE/SME/src/ccm/ccmApi.c +++ b/CORE/SME/src/ccm/ccmApi.c @@ -632,7 +632,14 @@ eHalStatus ccmCfgGetInt(tHalHandle hHal, tANI_U32 cfgId, tANI_U32 *pValue) { tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); eHalStatus status = eHAL_STATUS_SUCCESS ; - tCfgReq *req = pMac->ccm.comp[cfgId] ; + tCfgReq *req; + + if (cfgId >= CFG_PARAM_MAX_NUM) { + smsLog(pMac, LOGE, FL("Invalid cfg id %d"), cfgId); + return eHAL_STATUS_INVALID_PARAMETER; + } + + req = pMac->ccm.comp[cfgId] ; if (req && req->state == eCCM_REQ_DONE) { @@ -658,6 +665,12 @@ eHalStatus ccmCfgGetStr(tHalHandle hHal, tANI_U32 cfgId, tANI_U8 *pBuf, tANI_U32 return eHAL_STATUS_FAILURE; hHdd = halHandle2HddHandle(hHal); + + if (cfgId >= CFG_PARAM_MAX_NUM) { + smsLog(pMac, LOGE, FL("Invalid cfg id %d"), cfgId); + return eHAL_STATUS_INVALID_PARAMETER; + } + req = pMac->ccm.comp[cfgId] ; if (req && req->state == eCCM_REQ_DONE && (tANI_U32)req->length <= *pLength) diff --git a/CORE/SME/src/csr/csrApiRoam.c b/CORE/SME/src/csr/csrApiRoam.c index 7da1867f2b94..582f5ffc553e 100644 --- a/CORE/SME/src/csr/csrApiRoam.c +++ b/CORE/SME/src/csr/csrApiRoam.c @@ -12386,72 +12386,6 @@ static void csrRoamUpdateConnectedProfileFromNewBss( tpAniSirGlobal pMac, tANI_U return; } -#ifdef FEATURE_WLAN_WAPI -eHalStatus csrRoamSetBKIDCache( tpAniSirGlobal pMac, tANI_U32 sessionId, tBkidCacheInfo *pBKIDCache, - tANI_U32 numItems ) -{ - eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; - tCsrRoamSession *pSession; - if(!CSR_IS_SESSION_VALID( pMac, sessionId )) - { - smsLog(pMac, LOGE, FL(" Invalid session ID")); - return status; - } - smsLog(pMac, LOGW, "csrRoamSetBKIDCache called, numItems = %d", numItems); - pSession = CSR_GET_SESSION( pMac, sessionId ); - if(numItems <= CSR_MAX_BKID_ALLOWED) - { - status = eHAL_STATUS_SUCCESS; - //numItems may be 0 to clear the cache - pSession->NumBkidCache = (tANI_U16)numItems; - if(numItems && pBKIDCache) - { - vos_mem_copy(pSession->BkidCacheInfo, pBKIDCache, - sizeof(tBkidCacheInfo) * numItems); - status = eHAL_STATUS_SUCCESS; - } - } - return (status); -} -eHalStatus csrRoamGetBKIDCache(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 *pNum, - tBkidCacheInfo *pBkidCache) -{ - eHalStatus status = eHAL_STATUS_INVALID_PARAMETER; - tCsrRoamSession *pSession; - if(!CSR_IS_SESSION_VALID( pMac, sessionId )) - { - smsLog(pMac, LOGE, FL(" Invalid session ID")); - return status; - } - pSession = CSR_GET_SESSION( pMac, sessionId ); - if(pNum && pBkidCache) - { - if(pSession->NumBkidCache == 0) - { - *pNum = 0; - status = eHAL_STATUS_SUCCESS; - } - else if(*pNum >= pSession->NumBkidCache) - { - if(pSession->NumBkidCache > CSR_MAX_PMKID_ALLOWED) - { - smsLog(pMac, LOGE, FL("NumPmkidCache :%d is more than CSR_MAX_PMKID_ALLOWED, resetting to CSR_MAX_PMKID_ALLOWED"), - pSession->NumBkidCache); - pSession->NumBkidCache = CSR_MAX_PMKID_ALLOWED; - } - vos_mem_copy(pBkidCache, pSession->BkidCacheInfo, - sizeof(tBkidCacheInfo) * pSession->NumBkidCache); - *pNum = pSession->NumBkidCache; - status = eHAL_STATUS_SUCCESS; - } - } - return (status); -} -tANI_U32 csrRoamGetNumBKIDCache(tpAniSirGlobal pMac, tANI_U32 sessionId) -{ - return (pMac->roam.roamSession[sessionId].NumBkidCache); -} -#endif /* FEATURE_WLAN_WAPI */ #ifdef WLAN_FEATURE_ROAM_OFFLOAD eHalStatus csrRoamSetPSK_PMK (tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U8 *pPSK_PMK) diff --git a/CORE/SME/src/sme_common/sme_Api.c b/CORE/SME/src/sme_common/sme_Api.c index ecd52436694e..9af1531fa196 100644 --- a/CORE/SME/src/sme_common/sme_Api.c +++ b/CORE/SME/src/sme_common/sme_Api.c @@ -6376,88 +6376,6 @@ VOS_STATUS sme_GetWcnssHardwareVersion(tHalHandle hHal, #ifdef FEATURE_WLAN_WAPI -/* --------------------------------------------------------------------------- - \fn sme_RoamSetBKIDCache - \brief The SME API exposed to HDD to allow HDD to provde SME the BKID - candidate list. - \param hHal - Handle to the HAL. The HAL handle is returned by the HAL after - it is opened (by calling halOpen). - \param pBKIDCache - caller allocated buffer point to an array of tBkidCacheInfo - \param numItems - a variable that has the number of tBkidCacheInfo allocated - when retruning, this is the number of items put into pBKIDCache - \return eHalStatus - when fail, it usually means the buffer allocated is not - big enough and pNumItems has the number of tBkidCacheInfo. - ---------------------------------------------------------------------------*/ -eHalStatus sme_RoamSetBKIDCache( tHalHandle hHal, tANI_U32 sessionId, tBkidCacheInfo *pBKIDCache, - tANI_U32 numItems ) -{ - eHalStatus status = eHAL_STATUS_FAILURE; - tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); - - status = sme_AcquireGlobalLock( &pMac->sme ); - if ( HAL_STATUS_SUCCESS( status ) ) - { - status = csrRoamSetBKIDCache( pMac, sessionId, pBKIDCache, numItems ); - sme_ReleaseGlobalLock( &pMac->sme ); - } - - return (status); -} - -/* --------------------------------------------------------------------------- - \fn sme_RoamGetBKIDCache - \brief The SME API exposed to HDD to allow HDD to request SME to return its - BKID cache. - \param hHal - Handle to the HAL. The HAL handle is returned by the HAL after - it is opened (by calling halOpen). - \param pNum - caller allocated memory that has the space of the number of - tBkidCacheInfo as input. Upon returned, *pNum has the needed number of entries - in SME cache. - \param pBkidCache - Caller allocated memory that contains BKID cache, if any, - upon return - \return eHalStatus - when fail, it usually means the buffer allocated is not - big enough. - ---------------------------------------------------------------------------*/ -eHalStatus sme_RoamGetBKIDCache(tHalHandle hHal, tANI_U32 *pNum, - tBkidCacheInfo *pBkidCache) -{ - eHalStatus status = eHAL_STATUS_FAILURE; - tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); - - status = sme_AcquireGlobalLock( &pMac->sme ); - if ( HAL_STATUS_SUCCESS( status ) ) - { - smsLog(pMac, LOGE, FL(" !!!!!!!!!!!!!!!!!!SessionId is hardcoded")); - status = csrRoamGetBKIDCache( pMac, 0, pNum, pBkidCache ); - sme_ReleaseGlobalLock( &pMac->sme ); - } - - return (status); -} - -/* --------------------------------------------------------------------------- - \fn sme_RoamGetNumBKIDCache - \brief The SME API exposed to HDD to allow HDD to request SME to return the - number of BKID cache entries. - \param hHal - Handle to the HAL. The HAL handle is returned by the HAL after - it is opened (by calling halOpen). - \return tANI_U32 - the number of BKID cache entries. - ---------------------------------------------------------------------------*/ -tANI_U32 sme_RoamGetNumBKIDCache(tHalHandle hHal, tANI_U32 sessionId) -{ - eHalStatus status = eHAL_STATUS_FAILURE; - tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); - tANI_U32 numBkidCache = 0; - - status = sme_AcquireGlobalLock( &pMac->sme ); - if ( HAL_STATUS_SUCCESS( status ) ) - { - numBkidCache = csrRoamGetNumBKIDCache( pMac, sessionId ); - sme_ReleaseGlobalLock( &pMac->sme ); - } - - return (numBkidCache); -} /* --------------------------------------------------------------------------- \fn sme_ScanGetBKIDCandidateList |
