Skip to content

Commit aa4ec06

Browse files
dmantipovjmberg-intel
authored andcommitted
wifi: cfg80211: use __counted_by where appropriate
Annotate 'sub_specs' of 'struct cfg80211_sar_specs', 'channels' of 'struct cfg80211_sched_scan_request', 'channels' of 'struct cfg80211_wowlan_nd_match', and 'matches' of 'struct cfg80211_wowlan_nd_info' with '__counted_by' attribute. Briefly tested with clang 18.1.1 and CONFIG_UBSAN_BOUNDS running iwlwifi. Signed-off-by: Dmitry Antipov <[email protected]> Link: https://msgid.link/[email protected] Signed-off-by: Johannes Berg <[email protected]>
1 parent f9a0757 commit aa4ec06

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

include/net/cfg80211.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2200,7 +2200,7 @@ struct cfg80211_sar_sub_specs {
22002200
struct cfg80211_sar_specs {
22012201
enum nl80211_sar_type type;
22022202
u32 num_sub_specs;
2203-
struct cfg80211_sar_sub_specs sub_specs[];
2203+
struct cfg80211_sar_sub_specs sub_specs[] __counted_by(num_sub_specs);
22042204
};
22052205

22062206

@@ -2838,7 +2838,7 @@ struct cfg80211_sched_scan_request {
28382838
struct list_head list;
28392839

28402840
/* keep last */
2841-
struct ieee80211_channel *channels[];
2841+
struct ieee80211_channel *channels[] __counted_by(n_channels);
28422842
};
28432843

28442844
/**
@@ -3582,7 +3582,7 @@ struct cfg80211_coalesce {
35823582
struct cfg80211_wowlan_nd_match {
35833583
struct cfg80211_ssid ssid;
35843584
int n_channels;
3585-
u32 channels[];
3585+
u32 channels[] __counted_by(n_channels);
35863586
};
35873587

35883588
/**
@@ -3596,7 +3596,7 @@ struct cfg80211_wowlan_nd_match {
35963596
*/
35973597
struct cfg80211_wowlan_nd_info {
35983598
int n_matches;
3599-
struct cfg80211_wowlan_nd_match *matches[];
3599+
struct cfg80211_wowlan_nd_match *matches[] __counted_by(n_matches);
36003600
};
36013601

36023602
/**

0 commit comments

Comments
 (0)