summaryrefslogtreecommitdiffstats
path: root/net/wireless/sme.c
diff options
context:
space:
mode:
authorHaoyu Li <lihaoyu499@gmail.com>2024-12-03 16:20:49 +0100
committerJohannes Berg <johannes.berg@intel.com>2024-12-06 10:45:22 +0100
commitf1d3334d604cc32db63f6e2b3283011e02294e54 (patch)
tree137714e49f5d5aa60d2d22e7cb951faacd39e1c4 /net/wireless/sme.c
parentwifi: mac80211: fix station NSS capability initialization order (diff)
downloadlinux-f1d3334d604cc32db63f6e2b3283011e02294e54.tar.xz
linux-f1d3334d604cc32db63f6e2b3283011e02294e54.zip
wifi: cfg80211: sme: init n_channels before channels[] access
With the __counted_by annocation in cfg80211_scan_request struct, the "n_channels" struct member must be set before accessing the "channels" array. Failing to do so will trigger a runtime warning when enabling CONFIG_UBSAN_BOUNDS and CONFIG_FORTIFY_SOURCE. Fixes: e3eac9f32ec0 ("wifi: cfg80211: Annotate struct cfg80211_scan_request with __counted_by") Signed-off-by: Haoyu Li <lihaoyu499@gmail.com> Link: https://patch.msgid.link/20241203152049.348806-1-lihaoyu499@gmail.com Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/wireless/sme.c')
-rw-r--r--net/wireless/sme.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/net/wireless/sme.c b/net/wireless/sme.c
index 431da30817a6..268171600087 100644
--- a/net/wireless/sme.c
+++ b/net/wireless/sme.c
@@ -83,6 +83,7 @@ static int cfg80211_conn_scan(struct wireless_dev *wdev)
if (!request)
return -ENOMEM;
+ request->n_channels = n_channels;
if (wdev->conn->params.channel) {
enum nl80211_band band = wdev->conn->params.channel->band;
struct ieee80211_supported_band *sband =