From 8a090df3e5c643a2504d71202ef6432e50ced703 Mon Sep 17 00:00:00 2001 From: Krunal Soni Date: Thu, 3 May 2018 15:02:54 -0700 Subject: [PATCH] qcacld-3.0: Pass the arg by reference while calling sme_pdev_set_pcl() While calling sme_pdev_set_pcl() API, driver is passing the argument by value. The size of the argument is 280 bytes which is not good design. Pass the argument by reference instead of passing it by value to make design simple. CRs-Fixed: 2233212 Change-Id: I92849fb125fe864c1c7c7977bce392a7bcfe4121 --- core/sme/inc/sme_api.h | 2 +- core/sme/src/common/sme_api.c | 16 +++++++++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/core/sme/inc/sme_api.h b/core/sme/inc/sme_api.h index cd63e6914dd8..753a6954d6b0 100644 --- a/core/sme/inc/sme_api.h +++ b/core/sme/inc/sme_api.h @@ -1029,7 +1029,7 @@ void sme_update_user_configured_nss(tHalHandle hal, uint8_t nss); bool sme_is_any_session_in_connected_state(tHalHandle h_hal); -QDF_STATUS sme_pdev_set_pcl(struct policy_mgr_pcl_list msg); +QDF_STATUS sme_pdev_set_pcl(struct policy_mgr_pcl_list *msg); QDF_STATUS sme_pdev_set_hw_mode(struct policy_mgr_hw_mode msg); void sme_register_hw_mode_trans_cb(tHalHandle hal, hw_mode_transition_cb callback); diff --git a/core/sme/src/common/sme_api.c b/core/sme/src/common/sme_api.c index 33e116a1361d..11591e34e22d 100644 --- a/core/sme/src/common/sme_api.c +++ b/core/sme/src/common/sme_api.c @@ -13296,7 +13296,7 @@ QDF_STATUS sme_set_rssi_monitoring(tHalHandle hal, * Sends the command to WMA to send WMI_PDEV_SET_PCL_CMDID to FW * Return: QDF_STATUS_SUCCESS on successful posting */ -QDF_STATUS sme_pdev_set_pcl(struct policy_mgr_pcl_list msg) +QDF_STATUS sme_pdev_set_pcl(struct policy_mgr_pcl_list *msg) { QDF_STATUS status = QDF_STATUS_SUCCESS; tpAniSirGlobal mac = sme_get_mac_context(); @@ -13308,6 +13308,12 @@ QDF_STATUS sme_pdev_set_pcl(struct policy_mgr_pcl_list msg) sme_err("mac is NULL"); return QDF_STATUS_E_FAILURE; } + + if (!msg) { + sme_err("msg is NULL"); + return QDF_STATUS_E_FAILURE; + } + len = sizeof(*req_msg); req_msg = qdf_mem_malloc(len); @@ -13316,12 +13322,12 @@ QDF_STATUS sme_pdev_set_pcl(struct policy_mgr_pcl_list msg) return QDF_STATUS_E_NOMEM; } - for (i = 0; i < msg.pcl_len; i++) { - req_msg->pcl_list[i] = msg.pcl_list[i]; - req_msg->weight_list[i] = msg.weight_list[i]; + for (i = 0; i < msg->pcl_len; i++) { + req_msg->pcl_list[i] = msg->pcl_list[i]; + req_msg->weight_list[i] = msg->weight_list[i]; } - req_msg->pcl_len = msg.pcl_len; + req_msg->pcl_len = msg->pcl_len; status = sme_acquire_global_lock(&mac->sme); if (status != QDF_STATUS_SUCCESS) {