Skip to content

Commit f1d3334

Browse files
learjet5jmberg-intel
authored andcommitted
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: e3eac9f ("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>
1 parent 819e0f1 commit f1d3334

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

net/wireless/sme.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ static int cfg80211_conn_scan(struct wireless_dev *wdev)
8383
if (!request)
8484
return -ENOMEM;
8585

86+
request->n_channels = n_channels;
8687
if (wdev->conn->params.channel) {
8788
enum nl80211_band band = wdev->conn->params.channel->band;
8889
struct ieee80211_supported_band *sband =

0 commit comments

Comments
 (0)