0026-wifi-ath11k-Fix-scan-request-param-frame-size-warnin.patch 5.1 KB

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