Re: [PATCH 6/6] Bluetooth: Add MGMT command for controller capabilities

From: kernel test robot
Date: Thu Sep 17 2020 - 03:32:46 EST


Hi Daniel,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on bluetooth-next/master]
[also build test WARNING on next-20200916]
[cannot apply to net-next/master net/master v5.9-rc5]
[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]

url: https://github.com/0day-ci/linux/commits/Daniel-Winkler/Bluetooth-Add-new-MGMT-interface-for-advertising-add/20200917-042141
base: https://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next.git master
config: x86_64-randconfig-s022-20200917 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.2-201-g24bdaac6-dirty
# save the attached .config to linux build tree
make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=x86_64

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>


sparse warnings: (new ones prefixed by >>)

net/bluetooth/mgmt.c:3647:29: sparse: sparse: restricted __le16 degrades to integer
net/bluetooth/mgmt.c:4104:9: sparse: sparse: cast to restricted __le32
>> net/bluetooth/mgmt.c:4386:27: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __le16 [usertype] type @@ got int @@
>> net/bluetooth/mgmt.c:4386:27: sparse: expected restricted __le16 [usertype] type
>> net/bluetooth/mgmt.c:4386:27: sparse: got int

# https://github.com/0day-ci/linux/commit/171d4465b1f2811c76267c2f0acbcd0f77b5e99a
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Daniel-Winkler/Bluetooth-Add-new-MGMT-interface-for-advertising-add/20200917-042141
git checkout 171d4465b1f2811c76267c2f0acbcd0f77b5e99a
vim +4386 net/bluetooth/mgmt.c

4360
4361 static int read_controller_cap(struct sock *sk, struct hci_dev *hdev,
4362 void *data, u16 len)
4363 {
4364 u8 i = 0;
4365
4366 /* This command will return its data in TVL format. Currently we only
4367 * wish to include LE tx power parameters, so this struct can be given
4368 * a fixed size as data types are not changing.
4369 */
4370 struct {
4371 struct mgmt_tlv entry;
4372 __s8 value;
4373 } __packed cap[2];
4374
4375 BT_DBG("request for %s", hdev->name);
4376 memset(cap, 0, sizeof(cap));
4377
4378 hci_dev_lock(hdev);
4379
4380 /* Append LE tx power bounds */
4381 cap[i].entry.type = MGMT_CAP_LE_TX_PWR_MIN;
4382 cap[i].entry.length = sizeof(__s8);
4383 cap[i].value = hdev->min_le_tx_power;
4384 i++;
4385
> 4386 cap[i].entry.type = MGMT_CAP_LE_TX_PWR_MAX;
4387 cap[i].entry.length = sizeof(__s8);
4388 cap[i].value = hdev->max_le_tx_power;
4389 i++;
4390
4391 hci_dev_unlock(hdev);
4392
4393 return mgmt_cmd_complete(sk, hdev->id, MGMT_OP_READ_CONTROLLER_CAP,
4394 MGMT_STATUS_SUCCESS, cap, sizeof(cap));
4395 }
4396

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip