diff mbox series

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

Message ID 20241021143419.587716-1-dmantipov@yandex.ru
State New
Headers show
Series [1/2] wifi: ath12k: annotate skb of struct ath12k_ce_ring with __counted_by | expand

Commit Message

Dmitry Antipov Oct. 21, 2024, 2:34 p.m. UTC
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 <dmantipov@yandex.ru>
---
 drivers/net/wireless/ath/ath12k/ce.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Gustavo A. R. Silva Oct. 23, 2024, 9:43 p.m. UTC | #1
On 21/10/24 08:34, Dmitry Antipov wrote:
> 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.

It seems you didn't[1] actually build-test this changes. :/

-Gustavo

[1] https://lore.kernel.org/linux-hardening/202410231916.Wjn5HeB6-lkp@intel.com/

> 
> Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
> ---
>   drivers/net/wireless/ath/ath12k/wmi.h | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/wireless/ath/ath12k/wmi.h b/drivers/net/wireless/ath/ath12k/wmi.h
> index 6a913f9b8315..9a6e28142754 100644
> --- a/drivers/net/wireless/ath/ath12k/wmi.h
> +++ b/drivers/net/wireless/ath/ath12k/wmi.h
> @@ -3746,7 +3746,7 @@ struct wmi_stop_scan_cmd {
>   struct ath12k_wmi_scan_chan_list_arg {
>   	u32 pdev_id;
>   	u16 nallchans;
> -	struct ath12k_wmi_channel_arg channel[];
> +	struct ath12k_wmi_channel_arg channel[] __counted_by(nallchains);
>   };
>   
>   struct wmi_scan_chan_list_cmd {
diff mbox series

Patch

diff --git a/drivers/net/wireless/ath/ath12k/ce.h b/drivers/net/wireless/ath/ath12k/ce.h
index 857bc5f9e946..6967e3891030 100644
--- a/drivers/net/wireless/ath/ath12k/ce.h
+++ b/drivers/net/wireless/ath/ath12k/ce.h
@@ -135,7 +135,7 @@  struct ath12k_ce_ring {
 	u32 hal_ring_id;
 
 	/* keep last */
-	struct sk_buff *skb[];
+	struct sk_buff *skb[] __counted_by(nentries);
 };
 
 struct ath12k_ce_pipe {