Re: [PATCH] Bluetooth: hci-core: fix "declaration does not declare anything" error

kernel test robot <[email protected]>
Newsgroups dev.linux.lists.oe-kbuild
Message-ID <[email protected]>
:::::: 
:::::: Manual check reason: "linux-review patch is more than 7 days old, verify it wasn't already superseded"
:::::: 

BCC: [email protected]
CC: [email protected]
In-Reply-To: <[email protected]>
References: <[email protected]>
TO: David Marlin <[email protected]>
TO: [email protected]
TO: Luiz Augusto von Dentz <[email protected]>
CC: "Gustavo A . R . Silva" <[email protected]>
CC: David Marlin <[email protected]>
CC: Bastien Nocera <[email protected]>

Hi David,

kernel test robot noticed the following build errors:

[auto build test ERROR on bluetooth-next/master]
[also build test ERROR on bluetooth/master linus/master v7.2 next-20260820]
[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/David-Marlin/Bluetooth-hci-core-fix-declaration-does-not-declare-anything-error/20260814-001012
base:   https://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next.git master
patch link:    https://lore.kernel.org/r/20260814051032.261320-1-dmarlin%40redhat.com
patch subject: [PATCH] Bluetooth: hci-core: fix "declaration does not declare anything" error
:::::: branch date: 32 hours ago
:::::: commit date: 32 hours ago
config: nios2-allmodconfig (https://download.01.org/0day-ci/archive/20260822/[email protected]/config)
compiler: nios2-linux-gcc (GCC) 11.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260822/[email protected]/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 <[email protected]>
| Closes: https://lore.kernel.org/r/[email protected]/

All errors (new ones prefixed by >>):

   net/bluetooth/hci_codec.c: In function 'hci_read_supported_codecs':
>> net/bluetooth/hci_codec.c:151:9: error: aggregate value used where an integer was expected
     151 |         if (skb->len < flex_array_size(std_codecs, codec, std_codecs->num)
         |         ^~
   In file included from include/linux/bits.h:32,
                    from include/linux/ratelimit_types.h:5,
                    from include/linux/printk.h:9,
                    from include/asm-generic/bug.h:31,
                    from ./arch/nios2/include/generated/asm/bug.h:1,
                    from include/linux/ktime.h:24,
                    from include/linux/poll.h:7,
                    from include/net/bluetooth/bluetooth.h:26,
                    from net/bluetooth/hci_codec.c:5:
>> include/linux/overflow.h:420:25: error: invalid operands to binary * (have 'struct hci_std_codecs_hdr' and 'unsigned int')
     420 |                 (count) * sizeof(*(p)->member) + __must_be_array((p)->member),  \
         |                 ~~~~~~~ ^
   net/bluetooth/hci_codec.c:151:24: note: in expansion of macro 'flex_array_size'
     151 |         if (skb->len < flex_array_size(std_codecs, codec, std_codecs->num)
         |                        ^~~~~~~~~~~~~~~
>> net/bluetooth/hci_codec.c:151:69: error: incompatible type for argument 1 of 'size_mul'
     151 |         if (skb->len < flex_array_size(std_codecs, codec, std_codecs->num)
         |                                                           ~~~~~~~~~~^~~~~
         |                                                                     |
         |                                                                     struct hci_std_codecs_hdr
   include/linux/overflow.h:421:26: note: in definition of macro 'flex_array_size'
     421 |                 size_mul(count, sizeof(*(p)->member) + __must_be_array((p)->member)))
         |                          ^~~~~
   include/linux/overflow.h:330:60: note: expected 'size_t' {aka 'unsigned int'} but argument is of type 'struct hci_std_codecs_hdr'
     330 | static __always_inline size_t __must_check size_mul(size_t factor1, size_t factor2)
         |                                                     ~~~~~~~^~~~~~~
>> net/bluetooth/hci_codec.c:157:23: error: invalid operands to binary < (have 'int' and 'struct hci_std_codecs_hdr')
     157 |         for (i = 0; i < std_codecs->num; i++) {
         |                       ^ ~~~~~~~~~~~~~~~
         |                                   |
         |                                   struct hci_std_codecs_hdr
   net/bluetooth/hci_codec.c:164:9: error: aggregate value used where an integer was expected
     164 |         skb_pull(skb, flex_array_size(std_codecs, codec, std_codecs->num)
         |         ^~~~~~~~
   In file included from include/linux/bits.h:32,
                    from include/linux/ratelimit_types.h:5,
                    from include/linux/printk.h:9,
                    from include/asm-generic/bug.h:31,
                    from ./arch/nios2/include/generated/asm/bug.h:1,
                    from include/linux/ktime.h:24,
                    from include/linux/poll.h:7,
                    from include/net/bluetooth/bluetooth.h:26,
                    from net/bluetooth/hci_codec.c:5:
>> include/linux/overflow.h:420:25: error: invalid operands to binary * (have 'struct hci_std_codecs_hdr' and 'unsigned int')
     420 |                 (count) * sizeof(*(p)->member) + __must_be_array((p)->member),  \
         |                 ~~~~~~~ ^
   net/bluetooth/hci_codec.c:164:23: note: in expansion of macro 'flex_array_size'
     164 |         skb_pull(skb, flex_array_size(std_codecs, codec, std_codecs->num)
         |                       ^~~~~~~~~~~~~~~
   net/bluetooth/hci_codec.c:164:68: error: incompatible type for argument 1 of 'size_mul'
     164 |         skb_pull(skb, flex_array_size(std_codecs, codec, std_codecs->num)
         |                                                          ~~~~~~~~~~^~~~~
         |                                                                    |
         |                                                                    struct hci_std_codecs_hdr
   include/linux/overflow.h:421:26: note: in definition of macro 'flex_array_size'
     421 |                 size_mul(count, sizeof(*(p)->member) + __must_be_array((p)->member)))
         |                          ^~~~~
   include/linux/overflow.h:330:60: note: expected 'size_t' {aka 'unsigned int'} but argument is of type 'struct hci_std_codecs_hdr'
     330 | static __always_inline size_t __must_check size_mul(size_t factor1, size_t factor2)
         |                                                     ~~~~~~~^~~~~~~
   net/bluetooth/hci_codec.c: In function 'hci_read_supported_codecs_v2':
   net/bluetooth/hci_codec.c:220:9: error: aggregate value used where an integer was expected
     220 |         if (skb->len < flex_array_size(std_codecs, codec, std_codecs->num)
         |         ^~
   In file included from include/linux/bits.h:32,
                    from include/linux/ratelimit_types.h:5,
                    from include/linux/printk.h:9,
                    from include/asm-generic/bug.h:31,
                    from ./arch/nios2/include/generated/asm/bug.h:1,
                    from include/linux/ktime.h:24,
                    from include/linux/poll.h:7,
                    from include/net/bluetooth/bluetooth.h:26,
                    from net/bluetooth/hci_codec.c:5:
>> include/linux/overflow.h:420:25: error: invalid operands to binary * (have 'struct hci_std_codecs_v2_hdr' and 'unsigned int')
     420 |                 (count) * sizeof(*(p)->member) + __must_be_array((p)->member),  \
         |                 ~~~~~~~ ^
   net/bluetooth/hci_codec.c:220:24: note: in expansion of macro 'flex_array_size'
     220 |         if (skb->len < flex_array_size(std_codecs, codec, std_codecs->num)
         |                        ^~~~~~~~~~~~~~~
   net/bluetooth/hci_codec.c:220:69: error: incompatible type for argument 1 of 'size_mul'
     220 |         if (skb->len < flex_array_size(std_codecs, codec, std_codecs->num)
         |                                                           ~~~~~~~~~~^~~~~
         |                                                                     |
         |                                                                     struct hci_std_codecs_v2_hdr
   include/linux/overflow.h:421:26: note: in definition of macro 'flex_array_size'
     421 |                 size_mul(count, sizeof(*(p)->member) + __must_be_array((p)->member)))
         |                          ^~~~~
   include/linux/overflow.h:330:60: note: expected 'size_t' {aka 'unsigned int'} but argument is of type 'struct hci_std_codecs_v2_hdr'
     330 | static __always_inline size_t __must_check size_mul(size_t factor1, size_t factor2)
         |                                                     ~~~~~~~^~~~~~~
>> net/bluetooth/hci_codec.c:226:23: error: invalid operands to binary < (have 'int' and 'struct hci_std_codecs_v2_hdr')
     226 |         for (i = 0; i < std_codecs->num; i++) {
         |                       ^ ~~~~~~~~~~~~~~~
         |                                   |
         |                                   struct hci_std_codecs_v2_hdr
   net/bluetooth/hci_codec.c:232:9: error: aggregate value used where an integer was expected
     232 |         skb_pull(skb, flex_array_size(std_codecs, codec, std_codecs->num)
         |         ^~~~~~~~
   In file included from include/linux/bits.h:32,
                    from include/linux/ratelimit_types.h:5,
                    from include/linux/printk.h:9,
                    from include/asm-generic/bug.h:31,
                    from ./arch/nios2/include/generated/asm/bug.h:1,
                    from include/linux/ktime.h:24,
                    from include/linux/poll.h:7,
                    from include/net/bluetooth/bluetooth.h:26,
                    from net/bluetooth/hci_codec.c:5:
>> include/linux/overflow.h:420:25: error: invalid operands to binary * (have 'struct hci_std_codecs_v2_hdr' and 'unsigned int')
     420 |                 (count) * sizeof(*(p)->member) + __must_be_array((p)->member),  \
         |                 ~~~~~~~ ^
   net/bluetooth/hci_codec.c:232:23: note: in expansion of macro 'flex_array_size'
     232 |         skb_pull(skb, flex_array_size(std_codecs, codec, std_codecs->num)
         |                       ^~~~~~~~~~~~~~~
   net/bluetooth/hci_codec.c:232:68: error: incompatible type for argument 1 of 'size_mul'
     232 |         skb_pull(skb, flex_array_size(std_codecs, codec, std_codecs->num)
         |                                                          ~~~~~~~~~~^~~~~
         |                                                                    |
         |                                                                    struct hci_std_codecs_v2_hdr
   include/linux/overflow.h:421:26: note: in definition of macro 'flex_array_size'
     421 |                 size_mul(count, sizeof(*(p)->member) + __must_be_array((p)->member)))
         |                          ^~~~~
   include/linux/overflow.h:330:60: note: expected 'size_t' {aka 'unsigned int'} but argument is of type 'struct hci_std_codecs_v2_hdr'
     330 | static __always_inline size_t __must_check size_mul(size_t factor1, size_t factor2)
         |                                                     ~~~~~~~^~~~~~~
--
   hci_codec.c: In function 'hci_read_supported_codecs':
   hci_codec.c:151:9: error: aggregate value used where an integer was expected
     151 |         if (skb->len < flex_array_size(std_codecs, codec, std_codecs->num)
         |         ^~
   In file included from include/linux/bits.h:32,
                    from include/linux/ratelimit_types.h:5,
                    from include/linux/printk.h:9,
                    from include/asm-generic/bug.h:31,
                    from arch/nios2/include/generated/asm/bug.h:1,
                    from include/linux/ktime.h:24,
                    from include/linux/poll.h:7,
                    from include/net/bluetooth/bluetooth.h:26,
                    from hci_codec.c:5:
>> include/linux/overflow.h:420:25: error: invalid operands to binary * (have 'struct hci_std_codecs_hdr' and 'unsigned int')
     420 |                 (count) * sizeof(*(p)->member) + __must_be_array((p)->member),  \
         |                 ~~~~~~~ ^
   hci_codec.c:151:24: note: in expansion of macro 'flex_array_size'
     151 |         if (skb->len < flex_array_size(std_codecs, codec, std_codecs->num)
         |                        ^~~~~~~~~~~~~~~
   hci_codec.c:151:69: error: incompatible type for argument 1 of 'size_mul'
     151 |         if (skb->len < flex_array_size(std_codecs, codec, std_codecs->num)
         |                                                           ~~~~~~~~~~^~~~~
         |                                                                     |
         |                                                                     struct hci_std_codecs_hdr
   include/linux/overflow.h:421:26: note: in definition of macro 'flex_array_size'
     421 |                 size_mul(count, sizeof(*(p)->member) + __must_be_array((p)->member)))
         |                          ^~~~~
   include/linux/overflow.h:330:60: note: expected 'size_t' {aka 'unsigned int'} but argument is of type 'struct hci_std_codecs_hdr'
     330 | static __always_inline size_t __must_check size_mul(size_t factor1, size_t factor2)
         |                                                     ~~~~~~~^~~~~~~
   hci_codec.c:157:23: error: invalid operands to binary < (have 'int' and 'struct hci_std_codecs_hdr')
     157 |         for (i = 0; i < std_codecs->num; i++) {
         |                       ^ ~~~~~~~~~~~~~~~
         |                                   |
         |                                   struct hci_std_codecs_hdr
   hci_codec.c:164:9: error: aggregate value used where an integer was expected
     164 |         skb_pull(skb, flex_array_size(std_codecs, codec, std_codecs->num)
         |         ^~~~~~~~
   In file included from include/linux/bits.h:32,
                    from include/linux/ratelimit_types.h:5,
                    from include/linux/printk.h:9,
                    from include/asm-generic/bug.h:31,
                    from arch/nios2/include/generated/asm/bug.h:1,
                    from include/linux/ktime.h:24,
                    from include/linux/poll.h:7,
                    from include/net/bluetooth/bluetooth.h:26,
                    from hci_codec.c:5:
>> include/linux/overflow.h:420:25: error: invalid operands to binary * (have 'struct hci_std_codecs_hdr' and 'unsigned int')
     420 |                 (count) * sizeof(*(p)->member) + __must_be_array((p)->member),  \
         |                 ~~~~~~~ ^
   hci_codec.c:164:23: note: in expansion of macro 'flex_array_size'
     164 |         skb_pull(skb, flex_array_size(std_codecs, codec, std_codecs->num)
         |                       ^~~~~~~~~~~~~~~
   hci_codec.c:164:68: error: incompatible type for argument 1 of 'size_mul'
     164 |         skb_pull(skb, flex_array_size(std_codecs, codec, std_codecs->num)
         |                                                          ~~~~~~~~~~^~~~~
         |                                                                    |
         |                                                                    struct hci_std_codecs_hdr
   include/linux/overflow.h:421:26: note: in definition of macro 'flex_array_size'
     421 |                 size_mul(count, sizeof(*(p)->member) + __must_be_array((p)->member)))
         |                          ^~~~~
   include/linux/overflow.h:330:60: note: expected 'size_t' {aka 'unsigned int'} but argument is of type 'struct hci_std_codecs_hdr'
     330 | static __always_inline size_t __must_check size_mul(size_t factor1, size_t factor2)
         |                                                     ~~~~~~~^~~~~~~
   hci_codec.c: In function 'hci_read_supported_codecs_v2':
   hci_codec.c:220:9: error: aggregate value used where an integer was expected
     220 |         if (skb->len < flex_array_size(std_codecs, codec, std_codecs->num)
         |         ^~
   In file included from include/linux/bits.h:32,
                    from include/linux/ratelimit_types.h:5,
                    from include/linux/printk.h:9,
                    from include/asm-generic/bug.h:31,
                    from arch/nios2/include/generated/asm/bug.h:1,
                    from include/linux/ktime.h:24,
                    from include/linux/poll.h:7,
                    from include/net/bluetooth/bluetooth.h:26,
                    from hci_codec.c:5:
>> include/linux/overflow.h:420:25: error: invalid operands to binary * (have 'struct hci_std_codecs_v2_hdr' and 'unsigned int')
     420 |                 (count) * sizeof(*(p)->member) + __must_be_array((p)->member),  \
         |                 ~~~~~~~ ^
   hci_codec.c:220:24: note: in expansion of macro 'flex_array_size'
     220 |         if (skb->len < flex_array_size(std_codecs, codec, std_codecs->num)
         |                        ^~~~~~~~~~~~~~~
   hci_codec.c:220:69: error: incompatible type for argument 1 of 'size_mul'
     220 |         if (skb->len < flex_array_size(std_codecs, codec, std_codecs->num)
         |                                                           ~~~~~~~~~~^~~~~
         |                                                                     |
         |                                                                     struct hci_std_codecs_v2_hdr
   include/linux/overflow.h:421:26: note: in definition of macro 'flex_array_size'
     421 |                 size_mul(count, sizeof(*(p)->member) + __must_be_array((p)->member)))
         |                          ^~~~~
   include/linux/overflow.h:330:60: note: expected 'size_t' {aka 'unsigned int'} but argument is of type 'struct hci_std_codecs_v2_hdr'
     330 | static __always_inline size_t __must_check size_mul(size_t factor1, size_t factor2)
         |                                                     ~~~~~~~^~~~~~~
   hci_codec.c:226:23: error: invalid operands to binary < (have 'int' and 'struct hci_std_codecs_v2_hdr')
     226 |         for (i = 0; i < std_codecs->num; i++) {
         |                       ^ ~~~~~~~~~~~~~~~
         |                                   |
         |                                   struct hci_std_codecs_v2_hdr
   hci_codec.c:232:9: error: aggregate value used where an integer was expected
     232 |         skb_pull(skb, flex_array_size(std_codecs, codec, std_codecs->num)
         |         ^~~~~~~~
   In file included from include/linux/bits.h:32,
                    from include/linux/ratelimit_types.h:5,
                    from include/linux/printk.h:9,
                    from include/asm-generic/bug.h:31,
                    from arch/nios2/include/generated/asm/bug.h:1,
                    from include/linux/ktime.h:24,
                    from include/linux/poll.h:7,
                    from include/net/bluetooth/bluetooth.h:26,
                    from hci_codec.c:5:
>> include/linux/overflow.h:420:25: error: invalid operands to binary * (have 'struct hci_std_codecs_v2_hdr' and 'unsigned int')
     420 |                 (count) * sizeof(*(p)->member) + __must_be_array((p)->member),  \
         |                 ~~~~~~~ ^
   hci_codec.c:232:23: note: in expansion of macro 'flex_array_size'
     232 |         skb_pull(skb, flex_array_size(std_codecs, codec, std_codecs->num)
         |                       ^~~~~~~~~~~~~~~
   hci_codec.c:232:68: error: incompatible type for argument 1 of 'size_mul'
     232 |         skb_pull(skb, flex_array_size(std_codecs, codec, std_codecs->num)
         |                                                          ~~~~~~~~~~^~~~~
         |                                                                    |
         |                                                                    struct hci_std_codecs_v2_hdr
   include/linux/overflow.h:421:26: note: in definition of macro 'flex_array_size'
     421 |                 size_mul(count, sizeof(*(p)->member) + __must_be_array((p)->member)))
         |                          ^~~~~
   include/linux/overflow.h:330:60: note: expected 'size_t' {aka 'unsigned int'} but argument is of type 'struct hci_std_codecs_v2_hdr'
     330 | static __always_inline size_t __must_check size_mul(size_t factor1, size_t factor2)
         |                                                     ~~~~~~~^~~~~~~


vim +420 include/linux/overflow.h

610b15c50e86eb Kees Cook           2018-05-07  405  
b19d57d0f3cc6f Gustavo A. R. Silva 2020-06-08  406  /**
b19d57d0f3cc6f Gustavo A. R. Silva 2020-06-08  407   * flex_array_size() - Calculate size of a flexible array member
b19d57d0f3cc6f Gustavo A. R. Silva 2020-06-08  408   *                     within an enclosing structure.
b19d57d0f3cc6f Gustavo A. R. Silva 2020-06-08  409   * @p: Pointer to the structure.
b19d57d0f3cc6f Gustavo A. R. Silva 2020-06-08  410   * @member: Name of the flexible array member.
b19d57d0f3cc6f Gustavo A. R. Silva 2020-06-08  411   * @count: Number of elements in the array.
b19d57d0f3cc6f Gustavo A. R. Silva 2020-06-08  412   *
b19d57d0f3cc6f Gustavo A. R. Silva 2020-06-08  413   * Calculates size of a flexible array of @count number of @member
b19d57d0f3cc6f Gustavo A. R. Silva 2020-06-08  414   * elements, at the end of structure @p.
b19d57d0f3cc6f Gustavo A. R. Silva 2020-06-08  415   *
b19d57d0f3cc6f Gustavo A. R. Silva 2020-06-08  416   * Return: number of bytes needed or SIZE_MAX on overflow.
b19d57d0f3cc6f Gustavo A. R. Silva 2020-06-08  417   */
b19d57d0f3cc6f Gustavo A. R. Silva 2020-06-08  418  #define flex_array_size(p, member, count)				\
230f6fa2c1db6a Kees Cook           2022-02-09  419  	__builtin_choose_expr(__is_constexpr(count),			\
230f6fa2c1db6a Kees Cook           2022-02-09 @420  		(count) * sizeof(*(p)->member) + __must_be_array((p)->member),	\
230f6fa2c1db6a Kees Cook           2022-02-09  421  		size_mul(count, sizeof(*(p)->member) + __must_be_array((p)->member)))
b19d57d0f3cc6f Gustavo A. R. Silva 2020-06-08  422  

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.