From 43168e82c62896940f76bc3c9925f3c3ec3ff245 Mon Sep 17 00:00:00 2001 From: Hariharan Basuthkar Date: Wed, 7 Aug 2019 17:55:30 +0530 Subject: [PATCH] qcacmn: Dynamically allocate ch_list in wifi_pos_pdev_iterator() Dynamically allocate ch_list in wifi_pos_pdev_iterator(), to avoid exceeding the stack frame limit with the introduction of new channels. Change-Id: I41aaa3ad0405a3023768e5278dacf7475524c4e0 CRs-Fixed: 2463009 --- umac/wifi_pos/src/wifi_pos_main.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/umac/wifi_pos/src/wifi_pos_main.c b/umac/wifi_pos/src/wifi_pos_main.c index b298cbf69b..2f97e0aa59 100644 --- a/umac/wifi_pos/src/wifi_pos_main.c +++ b/umac/wifi_pos/src/wifi_pos_main.c @@ -713,21 +713,31 @@ static void wifi_pos_pdev_iterator(struct wlan_objmgr_psoc *psoc, void *obj, void *arg) { QDF_STATUS status; - uint8_t i, num_channels; + uint8_t i, num_channels, size; struct wlan_objmgr_pdev *pdev = obj; struct wifi_pos_driver_caps *caps = arg; - struct channel_power ch_list[NUM_CHANNELS]; + struct channel_power *ch_list; + + size = QDF_MAX(OEM_CAP_MAX_NUM_CHANNELS, NUM_CHANNELS); + ch_list = qdf_mem_malloc(size * sizeof(*ch_list)); + if (!ch_list) + return; status = wlan_reg_get_channel_list_with_power(pdev, ch_list, &num_channels); if (QDF_IS_STATUS_ERROR(status)) { wifi_pos_err("Failed to get valid channel list"); + qdf_mem_free(ch_list); return; } + if (num_channels > OEM_CAP_MAX_NUM_CHANNELS) + num_channels = OEM_CAP_MAX_NUM_CHANNELS; + for (i = 0; i < num_channels; i++) caps->channel_list[i] = ch_list[i].chan_num; caps->num_channels = num_channels; + qdf_mem_free(ch_list); } static void wifi_pos_get_ch_info(struct wlan_objmgr_psoc *psoc,