qcacld-3.0: Avoid allocating large chunk of memory statically
Currently in wlan_is_nan_allowed_on_6ghz_freq and __wlan_hdd_sysfs_freq_show static allocation of 6 GHz channel list is present which leads to stack overflow. To address this issue allocate 6 GHz channel list dynamically. Change-Id: If363270ab51516b67c68399f805a0434ccbb5bd3 CRs-Fixed: 3557442
This commit is contained in:

committed by
Rahul Choudhary

parent
3a331ae870
commit
43249aa86c
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2016-2021 The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
* Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for
|
||||
* any purpose with or without fee is hereby granted, provided that the
|
||||
@@ -415,8 +415,15 @@ static bool
|
||||
wlan_is_nan_allowed_on_6ghz_freq(struct wlan_objmgr_pdev *pdev, uint32_t freq)
|
||||
{
|
||||
QDF_STATUS status;
|
||||
struct regulatory_channel chan_list[NUM_6GHZ_CHANNELS];
|
||||
struct regulatory_channel *chan_list;
|
||||
uint32_t len_6g =
|
||||
NUM_6GHZ_CHANNELS * sizeof(struct regulatory_channel);
|
||||
uint16_t i;
|
||||
bool ret = false;
|
||||
|
||||
chan_list = qdf_mem_malloc(len_6g);
|
||||
if (!chan_list)
|
||||
return ret;
|
||||
|
||||
status = wlan_reg_get_6g_ap_master_chan_list(pdev,
|
||||
REG_VERY_LOW_POWER_AP,
|
||||
@@ -424,11 +431,15 @@ wlan_is_nan_allowed_on_6ghz_freq(struct wlan_objmgr_pdev *pdev, uint32_t freq)
|
||||
|
||||
for (i = 0; i < NUM_6GHZ_CHANNELS; i++) {
|
||||
if ((freq == chan_list[i].center_freq) &&
|
||||
(chan_list[i].state == CHANNEL_STATE_ENABLE))
|
||||
return true;
|
||||
(chan_list[i].state == CHANNEL_STATE_ENABLE)) {
|
||||
ret = true;
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
end:
|
||||
qdf_mem_free(chan_list);
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool wlan_is_nan_allowed_on_freq(struct wlan_objmgr_pdev *pdev, uint32_t freq)
|
||||
|
Reference in New Issue
Block a user