From 7890bbc0665f836a19b038d2534e2ef6fcb79997 Mon Sep 17 00:00:00 2001 From: Yingying Tang Date: Thu, 20 Oct 2016 17:43:59 +0800 Subject: qcacld-3.0: Fix incorrect NULL pointer check for SAP Propagate from qcacld-2.0 to qcacld-3.0 Currently there are some places where array name is compared to NULL in SAP. Add fix to correct it. CRs-Fixed: 1063255 Change-Id: I736ac42dd08cd6d3375b7693e914e825dae6c702 --- core/sap/src/sap_ch_select.c | 34 ++++++++++++++++++---------------- core/sap/src/sap_module.c | 20 ++++++++------------ 2 files changed, 26 insertions(+), 28 deletions(-) diff --git a/core/sap/src/sap_ch_select.c b/core/sap/src/sap_ch_select.c index dfbc660fa07e..77475acaa080 100644 --- a/core/sap/src/sap_ch_select.c +++ b/core/sap/src/sap_ch_select.c @@ -1214,22 +1214,24 @@ static void sap_compute_spect_weight(tSapChSelSpectInfo *pSpectInfoParams, vhtSupport = 0; centerFreq = 0; - if (pScanResult->BssDescriptor.ieFields != NULL) { - ieLen = GET_IE_LEN_IN_BSS( - pScanResult->BssDescriptor.length); - qdf_mem_set((uint8_t *) pBeaconStruct, - sizeof(tSirProbeRespBeacon), 0); - - if ((sir_parse_beacon_ie - (pMac, pBeaconStruct, (uint8_t *) - (pScanResult->BssDescriptor.ieFields), - ieLen)) == eSIR_SUCCESS) { - sap_upd_chan_spec_params(pBeaconStruct, - &channelWidth, &secondaryChannelOffset, - &vhtSupport, ¢erFreq, - ¢erFreq_2); - } - } + + ieLen = GET_IE_LEN_IN_BSS( + pScanResult->BssDescriptor.length); + qdf_mem_set((uint8_t *) pBeaconStruct, + sizeof(tSirProbeRespBeacon), 0); + + + if ((sir_parse_beacon_ie + (pMac, pBeaconStruct, (uint8_t *) + (pScanResult->BssDescriptor.ieFields), + ieLen)) == eSIR_SUCCESS) + sap_upd_chan_spec_params( + pBeaconStruct, + &channelWidth, + &secondaryChannelOffset, + &vhtSupport, ¢erFreq, + ¢erFreq_2); + /* Processing for each tCsrScanResultInfo in the tCsrScanResult DLink list */ for (chn_num = 0; chn_num < pSpectInfoParams->numSpectChans; chn_num++) { diff --git a/core/sap/src/sap_module.c b/core/sap/src/sap_module.c index 9761b72bcc8d..d9a6f1345123 100644 --- a/core/sap/src/sap_module.c +++ b/core/sap/src/sap_module.c @@ -1192,23 +1192,19 @@ QDF_STATUS wlansap_clear_acl(void *pCtx) return QDF_STATUS_E_RESOURCES; } - if (pSapCtx->denyMacList != NULL) { - for (i = 0; i < (pSapCtx->nDenyMac - 1); i++) { - qdf_mem_zero((pSapCtx->denyMacList + i)->bytes, - QDF_MAC_ADDR_SIZE); - - } + for (i = 0; i < (pSapCtx->nDenyMac - 1); i++) { + qdf_mem_zero((pSapCtx->denyMacList + i)->bytes, + QDF_MAC_ADDR_SIZE); } + sap_print_acl(pSapCtx->denyMacList, pSapCtx->nDenyMac); pSapCtx->nDenyMac = 0; - if (pSapCtx->acceptMacList != NULL) { - for (i = 0; i < (pSapCtx->nAcceptMac - 1); i++) { - qdf_mem_zero((pSapCtx->acceptMacList + i)->bytes, - QDF_MAC_ADDR_SIZE); - - } + for (i = 0; i < (pSapCtx->nAcceptMac - 1); i++) { + qdf_mem_zero((pSapCtx->acceptMacList + i)->bytes, + QDF_MAC_ADDR_SIZE); } + sap_print_acl(pSapCtx->acceptMacList, pSapCtx->nAcceptMac); pSapCtx->nAcceptMac = 0; -- cgit v1.2.3