Skip to content

Commit

Permalink
wifi: cfg80211: use __counted_by where appropriate
Browse files Browse the repository at this point in the history
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 <dmantipov@yandex.ru>
Link: https://msgid.link/20240517153332.18271-1-dmantipov@yandex.ru
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  • Loading branch information
Dmitry Antipov authored and Johannes Berg committed May 23, 2024
1 parent f9a0757 commit aa4ec06
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions include/net/cfg80211.h
Original file line number Diff line number Diff line change
Expand Up @@ -2200,7 +2200,7 @@ struct cfg80211_sar_sub_specs {
struct cfg80211_sar_specs {
enum nl80211_sar_type type;
u32 num_sub_specs;
struct cfg80211_sar_sub_specs sub_specs[];
struct cfg80211_sar_sub_specs sub_specs[] __counted_by(num_sub_specs);
};


Expand Down Expand Up @@ -2838,7 +2838,7 @@ struct cfg80211_sched_scan_request {
struct list_head list;

/* keep last */
struct ieee80211_channel *channels[];
struct ieee80211_channel *channels[] __counted_by(n_channels);
};

/**
Expand Down Expand Up @@ -3582,7 +3582,7 @@ struct cfg80211_coalesce {
struct cfg80211_wowlan_nd_match {
struct cfg80211_ssid ssid;
int n_channels;
u32 channels[];
u32 channels[] __counted_by(n_channels);
};

/**
Expand All @@ -3596,7 +3596,7 @@ struct cfg80211_wowlan_nd_match {
*/
struct cfg80211_wowlan_nd_info {
int n_matches;
struct cfg80211_wowlan_nd_match *matches[];
struct cfg80211_wowlan_nd_match *matches[] __counted_by(n_matches);
};

/**
Expand Down

0 comments on commit aa4ec06

Please sign in to comment.