From f76f6de348a3f5f2e9cb8e548a15bd9367f713ff Mon Sep 17 00:00:00 2001 From: Varun Reddy Yeturu Date: Tue, 17 Nov 2015 21:33:53 -0800 Subject: [PATCH] qcacld-3.0: Fix Static Analysis Issues 1) Check for bssid if it is NULL, before dereferencing it. 2) Check for hal_ctx if it is NULL, before dereferencing it. CRs-Fixed: 940721 Change-Id: I836416a4717b15902e8b8f27fa2e5e5e7935c12f --- core/sme/src/csr/csr_api_scan.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/core/sme/src/csr/csr_api_scan.c b/core/sme/src/csr/csr_api_scan.c index 37e197600c83..d79e148f481a 100644 --- a/core/sme/src/csr/csr_api_scan.c +++ b/core/sme/src/csr/csr_api_scan.c @@ -1415,7 +1415,7 @@ static int csr_get_altered_rssi(tpAniSirGlobal mac_ctx, int rssi, * preferred score */ cdf_mem_zero(&fav_bssid.bytes, CDF_MAC_ADDR_SIZE); - if (roam_params->num_bssid_favored) { + if (bssid && roam_params->num_bssid_favored) { for (i = 0; i < roam_params->num_bssid_favored; i++) { cdf_mem_copy(fav_bssid.bytes, &roam_params->bssid_favored[i], @@ -7110,6 +7110,11 @@ void csr_scan_active_list_timeout_handle(void *userData) FL("Scan Timeout: Scan command is NULL")); return; } + if (hal_ctx == NULL) { + CDF_TRACE(CDF_MODULE_ID_SME, CDF_TRACE_LEVEL_ERROR, + FL("HAL Context is NULL")); + return; + } mac_ctx = PMAC_STRUCT(hal_ctx); scan_id = scan_cmd->u.scanCmd.scanID; sms_log(mac_ctx, LOGE,