]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
wifi: ath10k: fix the stack frame size warning in ath10k_remain_on_channel
authorMiaoqing Pan <quic_miaoqing@quicinc.com>
Fri, 30 Aug 2024 01:53:49 +0000 (09:53 +0800)
committerKalle Valo <quic_kvalo@quicinc.com>
Sat, 28 Sep 2024 09:12:06 +0000 (12:12 +0300)
Fix the following W=1 kernel build warning:

drivers/net/wireless/ath/ath10k/mac.c: In function â€˜ath10k_remain_on_channel’:
drivers/net/wireless/ath/ath10k/mac.c:7980:1: warning: the frame size of 1064 bytes is larger than 1024 bytes [-Wframe-larger-than=]

Compile tested only.

Signed-off-by: Miaoqing Pan <quic_miaoqing@quicinc.com>
Acked-by: Jeff Johnson <quic_jjohnson@quicinc.com>
Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Link: https://patch.msgid.link/20240830015349.1083226-1-quic_miaoqing@quicinc.com
drivers/net/wireless/ath/ath10k/mac.c

index 6b467696bc982c51d6e45058d1dc860cee9b1123..77cab49d8ffc41282da735d5695f5b8942bb1f8c 100644 (file)
@@ -7899,7 +7899,7 @@ static int ath10k_remain_on_channel(struct ieee80211_hw *hw,
 {
        struct ath10k *ar = hw->priv;
        struct ath10k_vif *arvif = (void *)vif->drv_priv;
-       struct wmi_start_scan_arg arg;
+       struct wmi_start_scan_arg *arg = NULL;
        int ret = 0;
        u32 scan_time_msec;
 
@@ -7936,20 +7936,25 @@ static int ath10k_remain_on_channel(struct ieee80211_hw *hw,
 
        scan_time_msec = ar->hw->wiphy->max_remain_on_channel_duration * 2;
 
-       memset(&arg, 0, sizeof(arg));
-       ath10k_wmi_start_scan_init(ar, &arg);
-       arg.vdev_id = arvif->vdev_id;
-       arg.scan_id = ATH10K_SCAN_ID;
-       arg.n_channels = 1;
-       arg.channels[0] = chan->center_freq;
-       arg.dwell_time_active = scan_time_msec;
-       arg.dwell_time_passive = scan_time_msec;
-       arg.max_scan_time = scan_time_msec;
-       arg.scan_ctrl_flags |= WMI_SCAN_FLAG_PASSIVE;
-       arg.scan_ctrl_flags |= WMI_SCAN_FILTER_PROBE_REQ;
-       arg.burst_duration_ms = duration;
+       arg = kzalloc(sizeof(*arg), GFP_KERNEL);
+       if (!arg) {
+               ret = -ENOMEM;
+               goto exit;
+       }
 
-       ret = ath10k_start_scan(ar, &arg);
+       ath10k_wmi_start_scan_init(ar, arg);
+       arg->vdev_id = arvif->vdev_id;
+       arg->scan_id = ATH10K_SCAN_ID;
+       arg->n_channels = 1;
+       arg->channels[0] = chan->center_freq;
+       arg->dwell_time_active = scan_time_msec;
+       arg->dwell_time_passive = scan_time_msec;
+       arg->max_scan_time = scan_time_msec;
+       arg->scan_ctrl_flags |= WMI_SCAN_FLAG_PASSIVE;
+       arg->scan_ctrl_flags |= WMI_SCAN_FILTER_PROBE_REQ;
+       arg->burst_duration_ms = duration;
+
+       ret = ath10k_start_scan(ar, arg);
        if (ret) {
                ath10k_warn(ar, "failed to start roc scan: %d\n", ret);
                spin_lock_bh(&ar->data_lock);
@@ -7975,6 +7980,8 @@ static int ath10k_remain_on_channel(struct ieee80211_hw *hw,
 
        ret = 0;
 exit:
+       kfree(arg);
+
        mutex_unlock(&ar->conf_mutex);
        return ret;
 }