From 7cdfa7318f2d9267a6841dfcd83cce178250a58e Mon Sep 17 00:00:00 2001 From: Dundi Raviteja Date: Mon, 18 Jun 2018 11:57:37 +0530 Subject: [PATCH] qcacmn: Incorrect usage of QDF_ARRAY_SIZE macro In some use cases of QDF_ARRAY_SIZE macro, the argument passing to it is a pointer instead of array which leads to getting incorrect array size. Current implementation of updating main arrays pcl_list_org and weight_list_org is inefficient. So, update the main arrays directly, instead of copying the data to local arrays and again updating the main arrays. Change-Id: I9a4a7fa813412fd000ce55d2a958e49ab1b02ed5 CRs-Fixed: 2262231 --- .../policy_mgr/src/wlan_policy_mgr_pcl.c | 22 ++++--------------- 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/umac/cmn_services/policy_mgr/src/wlan_policy_mgr_pcl.c b/umac/cmn_services/policy_mgr/src/wlan_policy_mgr_pcl.c index 0dab0d739a6d..b122d2130cbb 100644 --- a/umac/cmn_services/policy_mgr/src/wlan_policy_mgr_pcl.c +++ b/umac/cmn_services/policy_mgr/src/wlan_policy_mgr_pcl.c @@ -248,21 +248,14 @@ static QDF_STATUS policy_mgr_modify_pcl_based_on_enabled_channels( uint32_t *pcl_len_org) { uint32_t i, pcl_len = 0; - uint8_t pcl_list[QDF_MAX_NUM_CHAN]; - uint8_t weight_list[QDF_MAX_NUM_CHAN]; for (i = 0; i < *pcl_len_org; i++) { if (!wlan_reg_is_passive_or_disable_ch( pm_ctx->pdev, pcl_list_org[i])) { - pcl_list[pcl_len] = pcl_list_org[i]; - weight_list[pcl_len++] = weight_list_org[i]; + pcl_list_org[pcl_len] = pcl_list_org[i]; + weight_list_org[pcl_len++] = weight_list_org[i]; } } - - qdf_mem_zero(pcl_list_org, QDF_ARRAY_SIZE(pcl_list_org)); - qdf_mem_zero(weight_list_org, QDF_ARRAY_SIZE(weight_list_org)); - qdf_mem_copy(pcl_list_org, pcl_list, pcl_len); - qdf_mem_copy(weight_list_org, weight_list, pcl_len); *pcl_len_org = pcl_len; return QDF_STATUS_SUCCESS; @@ -1517,8 +1510,6 @@ QDF_STATUS policy_mgr_modify_sap_pcl_based_on_mandatory_channel( uint32_t *pcl_len_org) { uint32_t i, j, pcl_len = 0; - uint8_t pcl_list[QDF_MAX_NUM_CHAN]; - uint8_t weight_list[QDF_MAX_NUM_CHAN]; bool found; struct policy_mgr_psoc_priv_obj *pm_ctx; @@ -1555,15 +1546,10 @@ QDF_STATUS policy_mgr_modify_sap_pcl_based_on_mandatory_channel( } } if (found && (pcl_len < QDF_MAX_NUM_CHAN)) { - pcl_list[pcl_len] = pcl_list_org[i]; - weight_list[pcl_len++] = weight_list_org[i]; + pcl_list_org[pcl_len] = pcl_list_org[i]; + weight_list_org[pcl_len++] = weight_list_org[i]; } } - - qdf_mem_zero(pcl_list_org, QDF_ARRAY_SIZE(pcl_list_org)); - qdf_mem_zero(weight_list_org, QDF_ARRAY_SIZE(weight_list_org)); - qdf_mem_copy(pcl_list_org, pcl_list, pcl_len); - qdf_mem_copy(weight_list_org, weight_list, pcl_len); *pcl_len_org = pcl_len; return QDF_STATUS_SUCCESS;