diff mbox series

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

Message ID 20241021143419.587716-2-dmantipov@yandex.ru (mailing list archive)
State Rejected
Delegated to: Kalle Valo
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
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.

Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
---
 drivers/net/wireless/ath/ath12k/wmi.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

kernel test robot Oct. 23, 2024, 12:09 p.m. UTC | #1
Hi Dmitry,

kernel test robot noticed the following build errors:

[auto build test ERROR on ath/ath-next]
[also build test ERROR on wireless-next/main wireless/main linus/master v6.12-rc4 next-20241022]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Dmitry-Antipov/wifi-ath12k-annotate-channel-of-struct-ath12k_wmi_scan_chan_list_arg-with-__counted_by/20241021-223544
base:   https://git.kernel.org/pub/scm/linux/kernel/git/ath/ath.git ath-next
patch link:    https://lore.kernel.org/r/20241021143419.587716-2-dmantipov%40yandex.ru
patch subject: [PATCH 2/2] wifi: ath12k: annotate channel of struct ath12k_wmi_scan_chan_list_arg with __counted_by
config: x86_64-allyesconfig (https://download.01.org/0day-ci/archive/20241023/202410231916.Wjn5HeB6-lkp@intel.com/config)
compiler: clang version 18.1.8 (https://github.com/llvm/llvm-project 3b5b5c1ec4a3095ab096dd780e84d7ab81f3d7ff)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241023/202410231916.Wjn5HeB6-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202410231916.Wjn5HeB6-lkp@intel.com/

All errors (new ones prefixed by >>):

   In file included from drivers/net/wireless/ath/ath12k/core.c:12:
   In file included from drivers/net/wireless/ath/ath12k/core.h:20:
>> drivers/net/wireless/ath/ath12k/wmi.h:3749:55: error: use of undeclared identifier 'nallchains'; did you mean 'nallchans'?
    3749 |         struct ath12k_wmi_channel_arg channel[] __counted_by(nallchains);
         |                                                              ^~~~~~~~~~
         |                                                              nallchans
   include/linux/compiler_attributes.h:105:62: note: expanded from macro '__counted_by'
     105 | # define __counted_by(member)           __attribute__((__counted_by__(member)))
         |                                                                       ^
   drivers/net/wireless/ath/ath12k/wmi.h:3748:6: note: 'nallchans' declared here
    3748 |         u16 nallchans;
         |             ^
   1 error generated.


vim +3749 drivers/net/wireless/ath/ath12k/wmi.h

  3745	
  3746	struct ath12k_wmi_scan_chan_list_arg {
  3747		u32 pdev_id;
  3748		u16 nallchans;
> 3749		struct ath12k_wmi_channel_arg channel[] __counted_by(nallchains);
  3750	};
  3751
Gustavo A. R. Silva Oct. 23, 2024, 9:43 p.m. UTC | #2
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/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 {