Skip to content

Commit 2b1b06b

Browse files
committed
wifi: mac80211: init cnt before accessing elem in ieee80211_copy_mbssid_beacon
JIRA: https://issues.redhat.com/browse/RHEL-73817 commit 496db69 Author: Haoyu Li <lihaoyu499@gmail.com> Date: Sun Nov 24 01:25:00 2024 +0800 wifi: mac80211: init cnt before accessing elem in ieee80211_copy_mbssid_beacon With the new __counted_by annocation in cfg80211_mbssid_elems, the "cnt" struct member must be set before accessing the "elem" array. Failing to do so will trigger a runtime warning when enabling CONFIG_UBSAN_BOUNDS and CONFIG_FORTIFY_SOURCE. Fixes: c14679d ("wifi: cfg80211: Annotate struct cfg80211_mbssid_elems with __counted_by") Signed-off-by: Haoyu Li <lihaoyu499@gmail.com> Link: https://patch.msgid.link/20241123172500.311853-1-lihaoyu499@gmail.com Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
1 parent 5223916 commit 2b1b06b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

net/mac80211/cfg.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1078,13 +1078,13 @@ ieee80211_copy_rnr_beacon(u8 *pos, struct cfg80211_rnr_elems *dst,
10781078
{
10791079
int i, offset = 0;
10801080

1081+
dst->cnt = src->cnt;
10811082
for (i = 0; i < src->cnt; i++) {
10821083
memcpy(pos + offset, src->elem[i].data, src->elem[i].len);
10831084
dst->elem[i].len = src->elem[i].len;
10841085
dst->elem[i].data = pos + offset;
10851086
offset += dst->elem[i].len;
10861087
}
1087-
dst->cnt = src->cnt;
10881088

10891089
return offset;
10901090
}

0 commit comments

Comments
 (0)