From 57effefdba383064f5c4012bae876e9137419a4f Mon Sep 17 00:00:00 2001 From: sheenam monga Date: Tue, 9 Apr 2019 15:37:33 +0530 Subject: [PATCH] qcacmn: Fix reachable Assert in convert_target_pdev_id_to_host_pdev_id Currently, If invalid pdev_id is passed to convert_target_pdev_id_to_host_pdev_id it results into Assert. Fix is to remove QDF_ASSERT(0) in convert_target_pdev_id_to_host_pdev_id. Return WMI_HOST_PDEV_ID_INVALID if convert_target_pdev_id_to_host_pdev_id receives invalid pdev id. Change-Id: Icb6a75c3f3664596fbba4532f5b29ed626ba28f2 CRs-Fixed: 2428787 --- wmi/inc/wmi_unified_param.h | 1 + wmi/src/wmi_unified_tlv.c | 17 +++++++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/wmi/inc/wmi_unified_param.h b/wmi/inc/wmi_unified_param.h index afd156124efa..718428b4e4ff 100644 --- a/wmi/inc/wmi_unified_param.h +++ b/wmi/inc/wmi_unified_param.h @@ -7363,6 +7363,7 @@ struct coex_config_params { #define WMI_HOST_PDEV_ID_0 0 #define WMI_HOST_PDEV_ID_1 1 #define WMI_HOST_PDEV_ID_2 2 +#define WMI_HOST_PDEV_ID_INVALID 0xFFFFFFFF #ifndef CMN_VDEV_MGR_TGT_IF_ENABLE /** diff --git a/wmi/src/wmi_unified_tlv.c b/wmi/src/wmi_unified_tlv.c index e66a59465173..4aed5049492e 100644 --- a/wmi/src/wmi_unified_tlv.c +++ b/wmi/src/wmi_unified_tlv.c @@ -109,9 +109,9 @@ static uint32_t convert_target_pdev_id_to_host_pdev_id(uint32_t pdev_id) return WMI_HOST_PDEV_ID_2; } - QDF_ASSERT(0); + WMI_LOGE("Invalid pdev_id"); - return WMI_HOST_PDEV_ID_SOC; + return WMI_HOST_PDEV_ID_INVALID; } /** @@ -10052,8 +10052,13 @@ static QDF_STATUS extract_dfs_radar_detection_event_tlv( } radar_event = param_tlv->fixed_param; + radar_found->pdev_id = convert_target_pdev_id_to_host_pdev_id( - radar_event->pdev_id); + radar_event->pdev_id); + + if (radar_found->pdev_id == WMI_HOST_PDEV_ID_INVALID) + return QDF_STATUS_E_FAILURE; + radar_found->detection_mode = radar_event->detection_mode; radar_found->chan_freq = radar_event->chan_freq; radar_found->chan_width = radar_event->chan_width; @@ -11009,8 +11014,12 @@ extract_esp_estimation_ev_param_tlv(wmi_unified_t wmi_handle, } esp_event = param_buf->fixed_param; param->ac_airtime_percentage = esp_event->ac_airtime_percentage; + param->pdev_id = convert_target_pdev_id_to_host_pdev_id( - esp_event->pdev_id); + esp_event->pdev_id); + + if (param->pdev_id == WMI_HOST_PDEV_ID_INVALID) + return QDF_STATUS_E_FAILURE; return QDF_STATUS_SUCCESS; }