Currently there are about 60 channels for 6 GHz, then the size of
chan_list in struct scan_req_params which is 40 is not enough to
fill all the channel list of 6 GHz.
Use dynamic memory to save the channel list of scan.
Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0-03427-QCAHMTSWPL_V1.0_V2.0_SILICONZ-1.15378.4
Signed-off-by: Wen Gong <quic_wgong@quicinc.com>
Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Link: https://lore.kernel.org/r/20230717033431.21983-1-quic_wgong@quicinc.com
 
 
        if (req->n_channels) {
                arg.num_chan = req->n_channels;
+               arg.chan_list = kcalloc(arg.num_chan, sizeof(*arg.chan_list),
+                                       GFP_KERNEL);
+
+               if (!arg.chan_list) {
+                       ret = -ENOMEM;
+                       goto exit;
+               }
+
                for (i = 0; i < arg.num_chan; i++)
                        arg.chan_list[i] = req->channels[i]->center_freq;
        }
                                                      ATH12K_MAC_SCAN_TIMEOUT_MSECS));
 
 exit:
+       kfree(arg.chan_list);
+
        if (req->ie_len)
                kfree(arg.extraie.ptr);
 
 
 
 #define WLAN_SCAN_MAX_NUM_SSID          10
 #define WLAN_SCAN_MAX_NUM_BSSID         10
-#define WLAN_SCAN_MAX_NUM_CHANNELS      40
 
 struct ath12k_wmi_element_info_arg {
        u32 len;
        u32 num_bssid;
        u32 num_ssids;
        u32 n_probes;
-       u32 chan_list[WLAN_SCAN_MAX_NUM_CHANNELS];
+       u32 *chan_list;
        u32 notify_scan_events;
        struct cfg80211_ssid ssid[WLAN_SCAN_MAX_NUM_SSID];
        struct ath12k_wmi_mac_addr_params bssid_list[WLAN_SCAN_MAX_NUM_BSSID];