All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Bluetooth: hci-core: fix "declaration does not declare anything" error
@ 2026-08-14  5:10 David Marlin
  2026-08-21  2:08 ` kernel test robot
  0 siblings, 1 reply; 3+ messages in thread
From: David Marlin @ 2026-08-14  5:10 UTC (permalink / raw)
  To: linux-bluetooth, Luiz Augusto von Dentz
  Cc: Gustavo A . R . Silva, David Marlin, Bastien Nocera

A recent build attempt, using gcc-14.4 on RHEL-10, produced the
following errors:

In file included from ./include/net/bluetooth/hci_core.h:35,
                 from net/bluetooth/hci_core.c:39:
./include/net/bluetooth/hci.h:1476:34: error: declaration does not
declare anything [-Werror]
  1476 |         struct hci_std_codecs_hdr;
       |                                  ^
./include/net/bluetooth/hci.h:1477:17: error: flexible array member in a
struct with no named members
  1477 |         __u8    codec[];
       |                 ^~~~~

./include/net/bluetooth/hci.h:1516:37: error: declaration does not
declare anything [-Werror]
  1516 |         struct hci_std_codecs_v2_hdr;
       |                                     ^
./include/net/bluetooth/hci.h:1517:33: error: flexible array member in a
struct with no named members
  1517 |         struct hci_std_codec_v2 codec[];
       |                                 ^~~~~

cc1: all warnings being treated as errors

Adding a variable name (e.g., 'num') to each of the above struct definitions
avoids the error without changing the layout of the struct.

Fixes: a0cff16d0f6e ("Bluetooth: hci.h: Avoid a couple -Wflex-array-member-not-at-end warnings")

Reviewed-by: Bastien Nocera <hadess@hadess.net>
Signed-off-by: David Marlin <dmarlin@redhat.com>
---
 include/net/bluetooth/hci.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index 1641d879dbda..5ccc4545e380 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -1472,7 +1472,7 @@ struct hci_std_codecs_hdr {
 } __packed;
 
 struct hci_std_codecs {
-	struct hci_std_codecs_hdr;
+	struct hci_std_codecs_hdr num;
 	__u8	codec[];
 } __packed;
 
@@ -1512,7 +1512,7 @@ struct hci_std_codecs_v2_hdr {
 } __packed;
 
 struct hci_std_codecs_v2 {
-	struct hci_std_codecs_v2_hdr;
+	struct hci_std_codecs_v2_hdr num;
 	struct hci_std_codec_v2 codec[];
 } __packed;
 
-- 
2.55.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] Bluetooth: hci-core: fix "declaration does not declare anything" error
  2026-08-14  5:10 David Marlin
@ 2026-08-21  2:08 ` kernel test robot
  0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2026-08-21  2:08 UTC (permalink / raw)
  To: David Marlin, linux-bluetooth, Luiz Augusto von Dentz
  Cc: llvm, oe-kbuild-all, Gustavo A . R . Silva, David Marlin,
	Bastien Nocera

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-20260819]
[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
config: loongarch-defconfig (https://download.01.org/0day-ci/archive/20260821/202608211016.aKSwZC8Y-lkp@intel.com/config)
compiler: clang version 24.0.0git (https://github.com/llvm/llvm-project 935bfc708590c60147a79c7df145bb6e68b1d388)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260821/202608211016.aKSwZC8Y-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/202608211016.aKSwZC8Y-lkp@intel.com/

All errors (new ones prefixed by >>):

>> net/bluetooth/hci_codec.c:151:17: error: operand of type 'struct hci_std_codecs_hdr' where arithmetic or pointer type is required
     151 |         if (skb->len < flex_array_size(std_codecs, codec, std_codecs->num)
         |                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/overflow.h:419:24: note: expanded from macro 'flex_array_size'
     419 |         __builtin_choose_expr(__is_constexpr(count),                    \
         |                               ^~~~~~~~~~~~~~~~~~~~~
   include/linux/compiler.h:323:47: note: expanded from macro '__is_constexpr'
     323 |         (sizeof(int) == sizeof(*(8 ? ((void *)((long)(x) * 0l)) : (int *)8)))
         |                                                      ^~~
>> net/bluetooth/hci_codec.c:157:16: error: invalid operands to binary expression ('__u8' (aka 'unsigned char') and 'struct hci_std_codecs_hdr')
     157 |         for (i = 0; i < std_codecs->num; i++) {
         |                     ~ ^ ~~~~~~~~~~~~~~~
   net/bluetooth/hci_codec.c:164:16: error: operand of type 'struct hci_std_codecs_hdr' where arithmetic or pointer type is required
     164 |         skb_pull(skb, flex_array_size(std_codecs, codec, std_codecs->num)
         |                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/overflow.h:419:24: note: expanded from macro 'flex_array_size'
     419 |         __builtin_choose_expr(__is_constexpr(count),                    \
         |                               ^~~~~~~~~~~~~~~~~~~~~
   include/linux/compiler.h:323:47: note: expanded from macro '__is_constexpr'
     323 |         (sizeof(int) == sizeof(*(8 ? ((void *)((long)(x) * 0l)) : (int *)8)))
         |                                                      ^~~
>> net/bluetooth/hci_codec.c:220:17: error: operand of type 'struct hci_std_codecs_v2_hdr' where arithmetic or pointer type is required
     220 |         if (skb->len < flex_array_size(std_codecs, codec, std_codecs->num)
         |                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/overflow.h:419:24: note: expanded from macro 'flex_array_size'
     419 |         __builtin_choose_expr(__is_constexpr(count),                    \
         |                               ^~~~~~~~~~~~~~~~~~~~~
   include/linux/compiler.h:323:47: note: expanded from macro '__is_constexpr'
     323 |         (sizeof(int) == sizeof(*(8 ? ((void *)((long)(x) * 0l)) : (int *)8)))
         |                                                      ^~~
>> net/bluetooth/hci_codec.c:226:16: error: invalid operands to binary expression ('__u8' (aka 'unsigned char') and 'struct hci_std_codecs_v2_hdr')
     226 |         for (i = 0; i < std_codecs->num; i++) {
         |                     ~ ^ ~~~~~~~~~~~~~~~
   net/bluetooth/hci_codec.c:232:16: error: operand of type 'struct hci_std_codecs_v2_hdr' where arithmetic or pointer type is required
     232 |         skb_pull(skb, flex_array_size(std_codecs, codec, std_codecs->num)
         |                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/overflow.h:419:24: note: expanded from macro 'flex_array_size'
     419 |         __builtin_choose_expr(__is_constexpr(count),                    \
         |                               ^~~~~~~~~~~~~~~~~~~~~
   include/linux/compiler.h:323:47: note: expanded from macro '__is_constexpr'
     323 |         (sizeof(int) == sizeof(*(8 ? ((void *)((long)(x) * 0l)) : (int *)8)))
         |                                                      ^~~
   6 errors generated.


vim +151 net/bluetooth/hci_codec.c

8961987f3f5fa2f Kiran K     2021-09-07  119  
8961987f3f5fa2f Kiran K     2021-09-07  120  void hci_read_supported_codecs(struct hci_dev *hdev)
8961987f3f5fa2f Kiran K     2021-09-07  121  {
8961987f3f5fa2f Kiran K     2021-09-07  122  	struct sk_buff *skb;
8961987f3f5fa2f Kiran K     2021-09-07  123  	struct hci_rp_read_local_supported_codecs *rp;
8961987f3f5fa2f Kiran K     2021-09-07  124  	struct hci_std_codecs *std_codecs;
8961987f3f5fa2f Kiran K     2021-09-07  125  	struct hci_vnd_codecs *vnd_codecs;
8961987f3f5fa2f Kiran K     2021-09-07  126  	struct hci_op_read_local_codec_caps caps;
8961987f3f5fa2f Kiran K     2021-09-07  127  	__u8 i;
8961987f3f5fa2f Kiran K     2021-09-07  128  
828cea2b71de501 Chethan T N 2022-11-22  129  	skb = __hci_cmd_sync_sk(hdev, HCI_OP_READ_LOCAL_CODECS, 0, NULL,
828cea2b71de501 Chethan T N 2022-11-22  130  				0, HCI_CMD_TIMEOUT, NULL);
8961987f3f5fa2f Kiran K     2021-09-07  131  
8961987f3f5fa2f Kiran K     2021-09-07  132  	if (IS_ERR(skb)) {
8961987f3f5fa2f Kiran K     2021-09-07  133  		bt_dev_err(hdev, "Failed to read local supported codecs (%ld)",
8961987f3f5fa2f Kiran K     2021-09-07  134  			   PTR_ERR(skb));
8961987f3f5fa2f Kiran K     2021-09-07  135  		return;
8961987f3f5fa2f Kiran K     2021-09-07  136  	}
8961987f3f5fa2f Kiran K     2021-09-07  137  
8961987f3f5fa2f Kiran K     2021-09-07  138  	if (skb->len < sizeof(*rp))
8961987f3f5fa2f Kiran K     2021-09-07  139  		goto error;
8961987f3f5fa2f Kiran K     2021-09-07  140  
8961987f3f5fa2f Kiran K     2021-09-07  141  	rp = (void *)skb->data;
8961987f3f5fa2f Kiran K     2021-09-07  142  
8961987f3f5fa2f Kiran K     2021-09-07  143  	if (rp->status)
8961987f3f5fa2f Kiran K     2021-09-07  144  		goto error;
8961987f3f5fa2f Kiran K     2021-09-07  145  
8961987f3f5fa2f Kiran K     2021-09-07  146  	skb_pull(skb, sizeof(rp->status));
8961987f3f5fa2f Kiran K     2021-09-07  147  
8961987f3f5fa2f Kiran K     2021-09-07  148  	std_codecs = (void *)skb->data;
8961987f3f5fa2f Kiran K     2021-09-07  149  
8961987f3f5fa2f Kiran K     2021-09-07  150  	/* validate codecs length before accessing */
8961987f3f5fa2f Kiran K     2021-09-07 @151  	if (skb->len < flex_array_size(std_codecs, codec, std_codecs->num)
8961987f3f5fa2f Kiran K     2021-09-07  152  	    + sizeof(std_codecs->num))
8961987f3f5fa2f Kiran K     2021-09-07  153  		goto error;
8961987f3f5fa2f Kiran K     2021-09-07  154  
8961987f3f5fa2f Kiran K     2021-09-07  155  	/* enumerate codec capabilities of standard codecs */
8961987f3f5fa2f Kiran K     2021-09-07  156  	memset(&caps, 0, sizeof(caps));
8961987f3f5fa2f Kiran K     2021-09-07 @157  	for (i = 0; i < std_codecs->num; i++) {
8961987f3f5fa2f Kiran K     2021-09-07  158  		caps.id = std_codecs->codec[i];
8961987f3f5fa2f Kiran K     2021-09-07  159  		caps.direction = 0x00;
828cea2b71de501 Chethan T N 2022-11-22  160  		hci_read_codec_capabilities(hdev,
828cea2b71de501 Chethan T N 2022-11-22  161  					    LOCAL_CODEC_ACL_MASK | LOCAL_CODEC_SCO_MASK, &caps);
8961987f3f5fa2f Kiran K     2021-09-07  162  	}
8961987f3f5fa2f Kiran K     2021-09-07  163  
8961987f3f5fa2f Kiran K     2021-09-07  164  	skb_pull(skb, flex_array_size(std_codecs, codec, std_codecs->num)
8961987f3f5fa2f Kiran K     2021-09-07  165  		 + sizeof(std_codecs->num));
8961987f3f5fa2f Kiran K     2021-09-07  166  
8961987f3f5fa2f Kiran K     2021-09-07  167  	vnd_codecs = (void *)skb->data;
8961987f3f5fa2f Kiran K     2021-09-07  168  
8961987f3f5fa2f Kiran K     2021-09-07  169  	/* validate vendor codecs length before accessing */
8961987f3f5fa2f Kiran K     2021-09-07  170  	if (skb->len <
8961987f3f5fa2f Kiran K     2021-09-07  171  	    flex_array_size(vnd_codecs, codec, vnd_codecs->num)
8961987f3f5fa2f Kiran K     2021-09-07  172  	    + sizeof(vnd_codecs->num))
8961987f3f5fa2f Kiran K     2021-09-07  173  		goto error;
8961987f3f5fa2f Kiran K     2021-09-07  174  
8961987f3f5fa2f Kiran K     2021-09-07  175  	/* enumerate vendor codec capabilities */
8961987f3f5fa2f Kiran K     2021-09-07  176  	for (i = 0; i < vnd_codecs->num; i++) {
8961987f3f5fa2f Kiran K     2021-09-07  177  		caps.id = 0xFF;
8961987f3f5fa2f Kiran K     2021-09-07  178  		caps.cid = vnd_codecs->codec[i].cid;
8961987f3f5fa2f Kiran K     2021-09-07  179  		caps.vid = vnd_codecs->codec[i].vid;
8961987f3f5fa2f Kiran K     2021-09-07  180  		caps.direction = 0x00;
828cea2b71de501 Chethan T N 2022-11-22  181  		hci_read_codec_capabilities(hdev,
828cea2b71de501 Chethan T N 2022-11-22  182  					    LOCAL_CODEC_ACL_MASK | LOCAL_CODEC_SCO_MASK, &caps);
8961987f3f5fa2f Kiran K     2021-09-07  183  	}
8961987f3f5fa2f Kiran K     2021-09-07  184  
8961987f3f5fa2f Kiran K     2021-09-07  185  error:
8961987f3f5fa2f Kiran K     2021-09-07  186  	kfree_skb(skb);
8961987f3f5fa2f Kiran K     2021-09-07  187  }
9ae664028a9ea83 Kiran K     2021-09-07  188  
9ae664028a9ea83 Kiran K     2021-09-07  189  void hci_read_supported_codecs_v2(struct hci_dev *hdev)
9ae664028a9ea83 Kiran K     2021-09-07  190  {
9ae664028a9ea83 Kiran K     2021-09-07  191  	struct sk_buff *skb;
9ae664028a9ea83 Kiran K     2021-09-07  192  	struct hci_rp_read_local_supported_codecs_v2 *rp;
9ae664028a9ea83 Kiran K     2021-09-07  193  	struct hci_std_codecs_v2 *std_codecs;
9ae664028a9ea83 Kiran K     2021-09-07  194  	struct hci_vnd_codecs_v2 *vnd_codecs;
9ae664028a9ea83 Kiran K     2021-09-07  195  	struct hci_op_read_local_codec_caps caps;
9ae664028a9ea83 Kiran K     2021-09-07  196  	__u8 i;
9ae664028a9ea83 Kiran K     2021-09-07  197  
828cea2b71de501 Chethan T N 2022-11-22  198  	skb = __hci_cmd_sync_sk(hdev, HCI_OP_READ_LOCAL_CODECS_V2, 0, NULL,
828cea2b71de501 Chethan T N 2022-11-22  199  				0, HCI_CMD_TIMEOUT, NULL);
9ae664028a9ea83 Kiran K     2021-09-07  200  
9ae664028a9ea83 Kiran K     2021-09-07  201  	if (IS_ERR(skb)) {
9ae664028a9ea83 Kiran K     2021-09-07  202  		bt_dev_err(hdev, "Failed to read local supported codecs (%ld)",
9ae664028a9ea83 Kiran K     2021-09-07  203  			   PTR_ERR(skb));
9ae664028a9ea83 Kiran K     2021-09-07  204  		return;
9ae664028a9ea83 Kiran K     2021-09-07  205  	}
9ae664028a9ea83 Kiran K     2021-09-07  206  
9ae664028a9ea83 Kiran K     2021-09-07  207  	if (skb->len < sizeof(*rp))
9ae664028a9ea83 Kiran K     2021-09-07  208  		goto error;
9ae664028a9ea83 Kiran K     2021-09-07  209  
9ae664028a9ea83 Kiran K     2021-09-07  210  	rp = (void *)skb->data;
9ae664028a9ea83 Kiran K     2021-09-07  211  
9ae664028a9ea83 Kiran K     2021-09-07  212  	if (rp->status)
9ae664028a9ea83 Kiran K     2021-09-07  213  		goto error;
9ae664028a9ea83 Kiran K     2021-09-07  214  
9ae664028a9ea83 Kiran K     2021-09-07  215  	skb_pull(skb, sizeof(rp->status));
9ae664028a9ea83 Kiran K     2021-09-07  216  
9ae664028a9ea83 Kiran K     2021-09-07  217  	std_codecs = (void *)skb->data;
9ae664028a9ea83 Kiran K     2021-09-07  218  
9ae664028a9ea83 Kiran K     2021-09-07  219  	/* check for payload data length before accessing */
9ae664028a9ea83 Kiran K     2021-09-07 @220  	if (skb->len < flex_array_size(std_codecs, codec, std_codecs->num)
9ae664028a9ea83 Kiran K     2021-09-07  221  	    + sizeof(std_codecs->num))
9ae664028a9ea83 Kiran K     2021-09-07  222  		goto error;
9ae664028a9ea83 Kiran K     2021-09-07  223  
9ae664028a9ea83 Kiran K     2021-09-07  224  	memset(&caps, 0, sizeof(caps));
9ae664028a9ea83 Kiran K     2021-09-07  225  
9ae664028a9ea83 Kiran K     2021-09-07 @226  	for (i = 0; i < std_codecs->num; i++) {

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Bluetooth: hci-core: fix "declaration does not declare anything" error
@ 2026-08-21 18:13 kernel test robot
  0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2026-08-21 18:13 UTC (permalink / raw)
  To: oe-kbuild; +Cc: lkp

:::::: 
:::::: Manual check reason: "linux-review patch is more than 7 days old, verify it wasn't already superseded"
:::::: 

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
In-Reply-To: <20260814051032.261320-1-dmarlin@redhat.com>
References: <20260814051032.261320-1-dmarlin@redhat.com>
TO: David Marlin <dmarlin@redhat.com>
TO: linux-bluetooth@vger.kernel.org
TO: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
CC: "Gustavo A . R . Silva" <gustavoars@kernel.org>
CC: David Marlin <dmarlin@redhat.com>
CC: Bastien Nocera <hadess@hadess.net>

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/202608220235.5cPUFtSW-lkp@intel.com/config)
compiler: nios2-linux-gcc (GCC) 11.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260822/202608220235.5cPUFtSW-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/r/202608220235.5cPUFtSW-lkp@intel.com/

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-08-21 18:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-21 18:13 [PATCH] Bluetooth: hci-core: fix "declaration does not declare anything" error kernel test robot
  -- strict thread matches above, loose matches on Subject: below --
2026-08-14  5:10 David Marlin
2026-08-21  2:08 ` kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.