Building the Linux kernel with Clang and LLVM
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: David Marlin <dmarlin@redhat.com>,
	linux-bluetooth@vger.kernel.org,
	Luiz Augusto von Dentz <luiz.dentz@gmail.com>
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev,
	"Gustavo A . R . Silva" <gustavoars@kernel.org>,
	David Marlin <dmarlin@redhat.com>,
	Bastien Nocera <hadess@hadess.net>
Subject: Re: [PATCH] Bluetooth: hci-core: fix "declaration does not declare anything" error
Date: Fri, 21 Aug 2026 10:08:06 +0800	[thread overview]
Message-ID: <202608211016.aKSwZC8Y-lkp@intel.com> (raw)
In-Reply-To: <20260814051032.261320-1-dmarlin@redhat.com>

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

           reply	other threads:[~2026-08-21  2:08 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <20260814051032.261320-1-dmarlin@redhat.com>]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202608211016.aKSwZC8Y-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=dmarlin@redhat.com \
    --cc=gustavoars@kernel.org \
    --cc=hadess@hadess.net \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=luiz.dentz@gmail.com \
    --cc=oe-kbuild-all@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox