50c14e7b98fb8da75a13592c07430e4fefb32e2d
[openwrt/staging/jow.git] /
1 From d45daa6d1a8da080f1b516c570a8428a7b9225e4 Mon Sep 17 00:00:00 2001
2 From: Karthikeyan Kathirvel <quic_kathirve@quicinc.com>
3 Date: Tue, 6 Dec 2022 00:51:25 +0530
4 Subject: [PATCH] wifi: ath11k: Fix scan request param frame size warning
5
6 Following warning was observed
7
8 drivers/net/wireless/ath/ath11k/mac.c:2351:1: warning: the frame
9 size of 1184 bytes is larger than 1024 bytes [-Wframe-larger-than=]
10
11 A local variable is declared with a size larger than 1024 bytes
12 this causing a compilation warning. Change the local variable to
13 heap memory to fix the warning.
14
15 Tested-on: IPQ8074 AHB WLAN.HK.2.7.0.1-01701-QCAHKSWPL_SILICONZ-1 v2
16
17 Signed-off-by: Karthikeyan Kathirvel <quic_kathirve@quicinc.com>
18 Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
19 Link: https://lore.kernel.org/r/20221205192125.13533-1-quic_kathirve@quicinc.com
20 ---
21 drivers/net/wireless/ath/ath11k/mac.c | 83 +++++++++++++++------------
22 1 file changed, 45 insertions(+), 38 deletions(-)
23
24 --- a/drivers/net/wireless/ath/ath11k/mac.c
25 +++ b/drivers/net/wireless/ath/ath11k/mac.c
26 @@ -3612,7 +3612,7 @@ static int ath11k_mac_op_hw_scan(struct
27 struct ath11k *ar = hw->priv;
28 struct ath11k_vif *arvif = ath11k_vif_to_arvif(vif);
29 struct cfg80211_scan_request *req = &hw_req->req;
30 - struct scan_req_params arg;
31 + struct scan_req_params *arg = NULL;
32 int ret = 0;
33 int i;
34 u32 scan_timeout;
35 @@ -3640,72 +3640,78 @@ static int ath11k_mac_op_hw_scan(struct
36 if (ret)
37 goto exit;
38
39 - memset(&arg, 0, sizeof(arg));
40 - ath11k_wmi_start_scan_init(ar, &arg);
41 - arg.vdev_id = arvif->vdev_id;
42 - arg.scan_id = ATH11K_SCAN_ID;
43 + arg = kzalloc(sizeof(*arg), GFP_KERNEL);
44 +
45 + if (!arg) {
46 + ret = -ENOMEM;
47 + goto exit;
48 + }
49 +
50 + ath11k_wmi_start_scan_init(ar, arg);
51 + arg->vdev_id = arvif->vdev_id;
52 + arg->scan_id = ATH11K_SCAN_ID;
53
54 if (req->ie_len) {
55 - arg.extraie.ptr = kmemdup(req->ie, req->ie_len, GFP_KERNEL);
56 - if (!arg.extraie.ptr) {
57 + arg->extraie.ptr = kmemdup(req->ie, req->ie_len, GFP_KERNEL);
58 + if (!arg->extraie.ptr) {
59 ret = -ENOMEM;
60 goto exit;
61 }
62 - arg.extraie.len = req->ie_len;
63 + arg->extraie.len = req->ie_len;
64 }
65
66 if (req->n_ssids) {
67 - arg.num_ssids = req->n_ssids;
68 - for (i = 0; i < arg.num_ssids; i++) {
69 - arg.ssid[i].length = req->ssids[i].ssid_len;
70 - memcpy(&arg.ssid[i].ssid, req->ssids[i].ssid,
71 + arg->num_ssids = req->n_ssids;
72 + for (i = 0; i < arg->num_ssids; i++) {
73 + arg->ssid[i].length = req->ssids[i].ssid_len;
74 + memcpy(&arg->ssid[i].ssid, req->ssids[i].ssid,
75 req->ssids[i].ssid_len);
76 }
77 } else {
78 - arg.scan_flags |= WMI_SCAN_FLAG_PASSIVE;
79 + arg->scan_flags |= WMI_SCAN_FLAG_PASSIVE;
80 }
81
82 if (req->n_channels) {
83 - arg.num_chan = req->n_channels;
84 - arg.chan_list = kcalloc(arg.num_chan, sizeof(*arg.chan_list),
85 - GFP_KERNEL);
86 + arg->num_chan = req->n_channels;
87 + arg->chan_list = kcalloc(arg->num_chan, sizeof(*arg->chan_list),
88 + GFP_KERNEL);
89
90 - if (!arg.chan_list) {
91 + if (!arg->chan_list) {
92 ret = -ENOMEM;
93 goto exit;
94 }
95
96 - for (i = 0; i < arg.num_chan; i++)
97 - arg.chan_list[i] = req->channels[i]->center_freq;
98 + for (i = 0; i < arg->num_chan; i++)
99 + arg->chan_list[i] = req->channels[i]->center_freq;
100 }
101
102 if (req->flags & NL80211_SCAN_FLAG_RANDOM_ADDR) {
103 - arg.scan_f_add_spoofed_mac_in_probe = 1;
104 - ether_addr_copy(arg.mac_addr.addr, req->mac_addr);
105 - ether_addr_copy(arg.mac_mask.addr, req->mac_addr_mask);
106 + arg->scan_f_add_spoofed_mac_in_probe = 1;
107 + ether_addr_copy(arg->mac_addr.addr, req->mac_addr);
108 + ether_addr_copy(arg->mac_mask.addr, req->mac_addr_mask);
109 }
110
111 /* if duration is set, default dwell times will be overwritten */
112 if (req->duration) {
113 - arg.dwell_time_active = req->duration;
114 - arg.dwell_time_active_2g = req->duration;
115 - arg.dwell_time_active_6g = req->duration;
116 - arg.dwell_time_passive = req->duration;
117 - arg.dwell_time_passive_6g = req->duration;
118 - arg.burst_duration = req->duration;
119 + arg->dwell_time_active = req->duration;
120 + arg->dwell_time_active_2g = req->duration;
121 + arg->dwell_time_active_6g = req->duration;
122 + arg->dwell_time_passive = req->duration;
123 + arg->dwell_time_passive_6g = req->duration;
124 + arg->burst_duration = req->duration;
125
126 - scan_timeout = min_t(u32, arg.max_rest_time *
127 - (arg.num_chan - 1) + (req->duration +
128 + scan_timeout = min_t(u32, arg->max_rest_time *
129 + (arg->num_chan - 1) + (req->duration +
130 ATH11K_SCAN_CHANNEL_SWITCH_WMI_EVT_OVERHEAD) *
131 - arg.num_chan, arg.max_scan_time);
132 + arg->num_chan, arg->max_scan_time);
133 } else {
134 - scan_timeout = arg.max_scan_time;
135 + scan_timeout = arg->max_scan_time;
136 }
137
138 /* Add a margin to account for event/command processing */
139 scan_timeout += ATH11K_MAC_SCAN_CMD_EVT_OVERHEAD;
140
141 - ret = ath11k_start_scan(ar, &arg);
142 + ret = ath11k_start_scan(ar, arg);
143 if (ret) {
144 ath11k_warn(ar->ab, "failed to start hw scan: %d\n", ret);
145 spin_lock_bh(&ar->data_lock);
146 @@ -3717,10 +3723,11 @@ static int ath11k_mac_op_hw_scan(struct
147 msecs_to_jiffies(scan_timeout));
148
149 exit:
150 - kfree(arg.chan_list);
151 -
152 - if (req->ie_len)
153 - kfree(arg.extraie.ptr);
154 + if (arg) {
155 + kfree(arg->chan_list);
156 + kfree(arg->extraie.ptr);
157 + kfree(arg);
158 + }
159
160 mutex_unlock(&ar->conf_mutex);
161