[PATCH 1/2] wifi: cfg80211: annotate struct cfg80211_mgmt_registration with __counted_by()

2024-12-10 Thread Dmitry Antipov
Add the '__counted_by()' compiler attribute to the flexible array member 'match[]' to improve access bounds-checking via CONFIG_UBSAN_BOUNDS and CONFIG_FORTIFY_SOURCE, adjust 'cfg80211_mlme_register_mgmt()' accordingly. Signed-off-by: Dmitry Antipov --- net/wi

[PATCH 2/2] wifi: cfg80211: simplify cfg80211_mlme_register_mgmt()

2024-12-10 Thread Dmitry Antipov
mbers are explicitly initialized. Fixes: 9dba48a6ece7 ("cfg80211: support multicast RX registration") Signed-off-by: Dmitry Antipov --- net/wireless/mlme.c | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/net/wireless/mlme.c b/net/wireless/mlme.c

[PATCH v2 1/2] wifi: ath12k: annotate skb of struct ath12k_ce_ring with __counted_by

2024-10-25 Thread Dmitry Antipov
According to 'ath12k_ce_alloc_ring()', annotate flexible array member 'skb' of 'struct ath12k_ce_ring' with '__counted_by()' to improve runtime bounds checking when CONFIG_UBSAN_BOUNDS is enabled. Compile tested only. Signed-off-by: Dmitry

[PATCH v2 2/2] wifi: ath12k: annotate channel of struct ath12k_wmi_scan_chan_list_arg with __counted_by

2024-10-24 Thread Dmitry Antipov
According to 'ath12k_reg_update_chan_list()', annotate flexible array member 'channel' of 'struct ath12k_wmi_scan_chan_list_arg' with '__counted_by()' attribute to improve runtime bounds checking when CONFIG_UBSAN_BOUNDS is enabled. Compile tested only. Si

[PATCH v2 1/3] wifi: ath11k: annotate skb of struct ath11k_ce_ring with __counted_by

2024-10-24 Thread Dmitry Antipov
According to 'ath11k_ce_alloc_ring()', annotate flexible array member 'skb' of 'struct ath11k_ce_ring' with '__counted_by()' to improve runtime bounds checking when CONFIG_UBSAN_BOUNDS is enabled. Compile tested only. Signed-off-by: Dmitry

[PATCH v2 2/3] wifi: ath11k: annotate ch_param of struct scan_chan_list_params with __counted_by

2024-10-24 Thread Dmitry Antipov
According to 'ath11k_reg_update_chan_list()', annotate flexible array member 'ch_param' of 'struct scan_chan_list_params' with '__counted_by()' attribute to improve runtime bounds checking when CONFIG_UBSAN_BOUNDS is enabled. Compile tested only. Signed-off

[PATCH v2 3/3] wifi: ath11k: miscellaneous spelling fixes

2024-10-24 Thread Dmitry Antipov
Correct spelling here and there as suggested by codespell. Signed-off-by: Dmitry Antipov --- v2: join the series --- drivers/net/wireless/ath/ath11k/hal.h | 6 +++--- drivers/net/wireless/ath/ath11k/mac.c | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/net

[PATCH 2/2] wifi: ath12k: annotate channel of struct ath12k_wmi_scan_chan_list_arg with __counted_by

2024-10-21 Thread Dmitry Antipov
According to 'ath12k_reg_update_chan_list()', annotate flexible array member 'channel' of 'struct ath12k_wmi_scan_chan_list_arg' with '__counted_by()' attribute to improve runtime bounds checking when CONFIG_UBSAN_BOUNDS is enabled. Compile tested only. Sig

[PATCH 1/2] wifi: ath12k: annotate skb of struct ath12k_ce_ring with __counted_by

2024-10-21 Thread Dmitry Antipov
Accorind to 'ath12k_ce_alloc_ring()', annotate flexible array member 'skb' of 'struct ath12k_ce_ring' with '__counted_by()' to improve runtime bounds checking when CONFIG_UBSAN_BOUNDS is enabled. Compile tested only. Signed-off-by: Dmitry Antipov ---

[PATCH 2/2] wifi: ath11k: annotate ch_param of struct scan_chan_list_params with __counted_by

2024-10-21 Thread Dmitry Antipov
According to 'ath11k_reg_update_chan_list()', annotate flexible array member 'ch_param' of 'struct scan_chan_list_params' with '__counted_by()' attribute to improve runtime bounds checking when CONFIG_UBSAN_BOUNDS is enabled. Compile tested only. Signed-

[PATCH 1/2] wifi: ath11k: annotate skb of struct ath11k_ce_ring with __counted_by

2024-10-21 Thread Dmitry Antipov
According to 'ath11k_ce_alloc_ring()', annotate flexible array member 'skb' of 'struct ath11k_ce_ring' with '__counted_by()' to improve runtime bounds checking when CONFIG_UBSAN_BOUNDS is enabled. Compile tested only. Signed-off-by: Dmitry Antipov ---

[PATCH v2] wifi: cfg80211: fix two more possible UBSAN-detected off-by-one errors

2024-09-09 Thread Dmitry Antipov
scheduled scans") Fixes: 5ba63533bbf6 ("cfg80211: fix alignment problem in scan request") Signed-off-by: Dmitry Antipov --- v2: fix title prefix as noticed by Kalle --- net/wireless/nl80211.c | 3 ++- net/wireless/sme.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff

[PATCH] wifi: wireless: fix two more possible UBSAN-detected off-by-one errors

2024-09-09 Thread Dmitry Antipov
scheduled scans") Fixes: 5ba63533bbf6 ("cfg80211: fix alignment problem in scan request") Signed-off-by: Dmitry Antipov --- net/wireless/nl80211.c | 3 ++- net/wireless/sme.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/net/wireless/nl80211.c b/net/wireles

[PATCH] wifi: cfg80211: fix UBSAN noise in cfg80211_wext_siwscan()

2024-09-05 Thread Dmitry Antipov
and use convenient 'struct_size()' to simplify the math here and in 'kzalloc()' above. Fixes: 5ba63533bbf6 ("cfg80211: fix alignment problem in scan request") Signed-off-by: Dmitry Antipov --- net/wireless/scan.c | 6 +++--- 1 file changed, 3 insertions(+),

[PATCH v3] net: core: annotate socks of struct sock_reuseport with __counted_by

2024-08-01 Thread Dmitry Antipov
According to '__reuseport_alloc()', annotate flexible array member 'sock' of 'struct sock_reuseport' with '__counted_by()' and use convenient 'struct_size()' to simplify the math used in 'kzalloc()'. Signed-off-by: Dmitry Antipov --

[PATCH v2] net: core: annotate socks of struct sock_reuseport with __counted_by

2024-07-30 Thread Dmitry Antipov
According to '__reuseport_alloc()', annotate flexible array member 'sock' of 'struct sock_reuseport' with '__counted_by()' and use convenient 'struct_size()' to simplify the math used in 'kzalloc()'. Signed-off-by: Dmitry Antip

[PATCH] net: core: use __counted_by for trailing VLA of struct sock_reuseport

2024-07-30 Thread Dmitry Antipov
According to '__reuseport_alloc()', annotate trailing VLA 'sock' of 'struct sock_reuseport' with '__counted_by()' and use convenient 'struct_size()' to simplify the math used in 'kzalloc()'. Signed-off-by: Dmitry Antipov --- include/n

[PATCH] wifi: wireless: fix more UBSAN noise in cfg80211_conn_scan()

2024-07-16 Thread Dmitry Antipov
n_channels' early to help '__counted_by()' work as expected. And the same 'kmalloc()' math adjustment is also applicable. Signed-off-by: Dmitry Antipov --- net/wireless/sme.c | 14 +- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/net/wireless/sme.c b/

[PATCH 1/2] wifi: cfg80211: use __counted_by where appropriate

2024-05-17 Thread Dmitry Antipov
x27;__counted_by' attribute. Briefly tested with clang 18.1.1 and CONFIG_UBSAN_BOUNDS running iwlwifi. Signed-off-by: Dmitry Antipov --- include/net/cfg80211.h | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index c

[PATCH 2/2] wifi: mac80211: fix UBSAN noise in ieee80211_prep_hw_scan()

2024-05-17 Thread Dmitry Antipov
scan()'. Although an initialization of 'hw_scan_req->req.n_channels' introduces some confusion around allocated vs. used VLA members, this shouldn't be a problem since everything is correctly adjusted soon in 'ieee80211_prep_hw_scan()'. Cleanup 'kmalloc()' math