diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index 2755cf0c7b73..f4f9217cce19 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -7156,11 +7156,18 @@ hdd_display_netif_queue_history_compact(struct hdd_context *hdd_ctx) u32 tbytes; qdf_time_t total, pause, unpause, curr_time, delta; char temp_str[20 * WLAN_REASON_TYPE_MAX]; - char comb_log_str[(ADAP_NETIFQ_LOG_LEN * MAX_NUMBER_OF_ADAPTERS) + 1]; + char *comb_log_str; + uint32_t comb_log_str_size; struct hdd_adapter *adapter = NULL; + comb_log_str_size = (ADAP_NETIFQ_LOG_LEN * MAX_NUMBER_OF_ADAPTERS) + 1; + comb_log_str = qdf_mem_malloc(comb_log_str_size); + if (!comb_log_str) { + hdd_err("failed to alloc comb_log_str"); + return; + } + bytes_written = 0; - qdf_mem_set(comb_log_str, 0, sizeof(comb_log_str)); hdd_for_each_adapter(hdd_ctx, adapter) { curr_time = qdf_system_ticks(); @@ -7196,8 +7203,8 @@ hdd_display_netif_queue_history_compact(struct hdd_context *hdd_ctx) hdd_warn("log truncated"); bytes_written += snprintf(&comb_log_str[bytes_written], - bytes_written >= sizeof(comb_log_str) ? 0 : - sizeof(comb_log_str) - bytes_written, + bytes_written >= comb_log_str_size ? 0 : + comb_log_str_size - bytes_written, "[%d %d] (%d) %u/%ums %s|", adapter->session_id, adapter->device_mode, adapter->pause_map, @@ -7212,8 +7219,10 @@ hdd_display_netif_queue_history_compact(struct hdd_context *hdd_ctx) QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_INFO_LOW, "STATS |%s", comb_log_str); - if (bytes_written >= sizeof(comb_log_str)) + if (bytes_written >= comb_log_str_size) hdd_warn("log string truncated"); + + qdf_mem_free(comb_log_str); } /** diff --git a/core/sme/inc/sme_api.h b/core/sme/inc/sme_api.h index 0327623965cd..93d6e7bd9b34 100644 --- a/core/sme/inc/sme_api.h +++ b/core/sme/inc/sme_api.h @@ -839,8 +839,8 @@ const char *sme_scan_type_to_string(const uint8_t scan_type); const char *sme_bss_type_to_string(const uint8_t bss_type); QDF_STATUS sme_ap_disable_intra_bss_fwd(tHalHandle hHal, uint8_t sessionId, bool disablefwd); -uint32_t sme_get_channel_bonding_mode5_g(tHalHandle hHal); -uint32_t sme_get_channel_bonding_mode24_g(tHalHandle hHal); +QDF_STATUS sme_get_channel_bonding_mode5_g(tHalHandle hHal, uint32_t *mode); +QDF_STATUS sme_get_channel_bonding_mode24_g(tHalHandle hHal, uint32_t *mode); #ifdef WLAN_FEATURE_STATS_EXT typedef struct sStatsExtRequestReq { uint32_t request_data_len; diff --git a/core/sme/src/common/sme_api.c b/core/sme/src/common/sme_api.c index 28c52aa5598c..5b50727696e4 100644 --- a/core/sme/src/common/sme_api.c +++ b/core/sme/src/common/sme_api.c @@ -3106,37 +3106,82 @@ eCsrPhyMode sme_get_phy_mode(tHalHandle hHal) } /* - * sme_get_channel_bonding_mode5_g() - - * get the channel bonding mode for 5G band + * sme_get_channel_bonding_mode5_g() - get the channel bonding mode for 5G band * * hHal - HAL handle - * Return channel bonding mode for 5G + * mode - channel bonding mode + * + * Return QDF_STATUS */ -uint32_t sme_get_channel_bonding_mode5_g(tHalHandle hHal) +QDF_STATUS sme_get_channel_bonding_mode5_g(tHalHandle hHal, uint32_t *mode) { tpAniSirGlobal pMac = PMAC_STRUCT(hHal); - tSmeConfigParams smeConfig; + tSmeConfigParams *smeConfig; - sme_get_config_param(pMac, &smeConfig); + if (!mode) { + QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, + "%s: invalid mode", __func__); + return QDF_STATUS_E_FAILURE; + } - return smeConfig.csrConfig.channelBondingMode5GHz; + smeConfig = qdf_mem_malloc(sizeof(*smeConfig)); + if (!smeConfig) { + QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, + "%s: failed to alloc smeConfig", __func__); + return QDF_STATUS_E_NOMEM; + } + + if (sme_get_config_param(pMac, smeConfig) != QDF_STATUS_SUCCESS) { + QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, + "%s: sme_get_config_param failed", __func__); + qdf_mem_free(smeConfig); + return QDF_STATUS_E_FAILURE; + } + + *mode = smeConfig->csrConfig.channelBondingMode5GHz; + qdf_mem_free(smeConfig); + + return QDF_STATUS_SUCCESS; } /* - * sme_get_channel_bonding_mode24_g() - - * get the channel bonding mode for 2.4G band + * sme_get_channel_bonding_mode24_g() - get the channel bonding mode for 2.4G + * band * * hHal - HAL handle - * Return channel bonding mode for 2.4G + * mode - channel bonding mode + * + * Return QDF_STATUS */ -uint32_t sme_get_channel_bonding_mode24_g(tHalHandle hHal) +QDF_STATUS sme_get_channel_bonding_mode24_g(tHalHandle hHal, uint32_t *mode) { tpAniSirGlobal pMac = PMAC_STRUCT(hHal); - tSmeConfigParams smeConfig; + tSmeConfigParams *smeConfig; - sme_get_config_param(pMac, &smeConfig); + if (!mode) { + QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, + "%s: invalid mode", __func__); + return QDF_STATUS_E_FAILURE; + } - return smeConfig.csrConfig.channelBondingMode24GHz; + smeConfig = qdf_mem_malloc(sizeof(*smeConfig)); + if (!smeConfig) { + QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, + "%s: failed to alloc smeConfig", __func__); + return QDF_STATUS_E_NOMEM; + } + + if (sme_get_config_param(pMac, smeConfig) != QDF_STATUS_SUCCESS) { + QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, + "%s: sme_get_config_param failed", __func__); + qdf_mem_free(smeConfig); + return QDF_STATUS_E_FAILURE; + } + + *mode = smeConfig->csrConfig.channelBondingMode24GHz; + qdf_mem_free(smeConfig); + + return QDF_STATUS_SUCCESS; } /*