From d3cb4778fe2b0e2dd3c1dfd0bf625601d60eb930 Mon Sep 17 00:00:00 2001 From: "Chandrasekaran, Manishekar" Date: Mon, 22 Feb 2016 22:21:10 +0530 Subject: [PATCH] qcacld-3.0: Fix potential static code analysis issues Fix potential null pointer access during sap open session and validation of the session id which could be reported during static code analysis. Change-Id: I6146c7223c586df06c08c76abd9e38a3c1ad1c4b CRs-Fixed: 979960 --- core/sap/src/sap_module.c | 6 ++++++ core/sme/src/common/sme_api.c | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/core/sap/src/sap_module.c b/core/sap/src/sap_module.c index bdde7c52339e..9961c6610168 100644 --- a/core/sap/src/sap_module.c +++ b/core/sap/src/sap_module.c @@ -201,6 +201,12 @@ QDF_STATUS wlansap_start(void *pCtx, enum tQDF_ADAPTER_MODE mode, } hal = (tHalHandle) CDS_GET_HAL_CB(pSapCtx->p_cds_gctx); + if (!hal) { + QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_ERROR, + "%s: Invalid HAL pointer", __func__); + return QDF_STATUS_E_INVAL; + } + qdf_ret_status = sap_open_session(hal, pSapCtx, session_id); if (QDF_STATUS_SUCCESS != qdf_ret_status) { diff --git a/core/sme/src/common/sme_api.c b/core/sme/src/common/sme_api.c index be84e41c73b1..4c87adcf469b 100644 --- a/core/sme/src/common/sme_api.c +++ b/core/sme/src/common/sme_api.c @@ -15130,7 +15130,9 @@ bool sme_is_session_id_valid(tHalHandle hal, uint32_t session_id) { tpAniSirGlobal mac = PMAC_STRUCT(hal); if (!mac) { - sms_log(mac, LOGE, FL("null mac pointer")); + /* Using QDF_TRACE since mac is not available for sms_log */ + QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, + "%s: null mac pointer", __func__); return false; }