Re: [PATCH v2 2/7] Bluetooth: Add handler of MGMT_OP_READ_ADV_MONITOR_FEATURES

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Miao-chen,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on bluetooth-next/master]
[also build test WARNING on next-20200604]
[cannot apply to v5.7]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Miao-chen-Chou/Bluetooth-Add-definitions-for-advertisement-monitor-features/20200604-070719
base:   https://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next.git master
config: alpha-randconfig-s031-20200604 (attached as .config)
compiler: alpha-linux-gcc (GCC) 9.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.1-244-g0ee050a8-dirty
        # save the attached .config to linux build tree
        make W=1 C=1 ARCH=alpha CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'

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:3597:29: sparse: sparse: restricted __le16 degrades to integer
>> net/bluetooth/mgmt.c:3886:32: sparse: sparse: incorrect type in assignment (different base types) @@     expected unsigned int [usertype] supported_features @@     got restricted __le32 [usertype] @@
>> net/bluetooth/mgmt.c:3886:32: sparse:     expected unsigned int [usertype] supported_features
>> net/bluetooth/mgmt.c:3886:32: sparse:     got restricted __le32 [usertype]
>> net/bluetooth/mgmt.c:3888:29: sparse: sparse: incorrect type in assignment (different base types) @@     expected unsigned short [usertype] max_num_handles @@     got restricted __le16 [usertype] @@
>> net/bluetooth/mgmt.c:3888:29: sparse:     expected unsigned short [usertype] max_num_handles
>> net/bluetooth/mgmt.c:3888:29: sparse:     got restricted __le16 [usertype]
>> net/bluetooth/mgmt.c:3890:25: sparse: sparse: incorrect type in assignment (different base types) @@     expected unsigned short [usertype] num_handles @@     got restricted __le16 [usertype] @@
>> net/bluetooth/mgmt.c:3890:25: sparse:     expected unsigned short [usertype] num_handles
   net/bluetooth/mgmt.c:3890:25: sparse:     got restricted __le16 [usertype]

vim +3886 net/bluetooth/mgmt.c

  3853	
  3854	static int read_adv_monitor_features(struct sock *sk, struct hci_dev *hdev,
  3855					     void *data, u16 len)
  3856	{
  3857		struct adv_monitor *monitor = NULL;
  3858		struct mgmt_rp_read_adv_monitor_features *rp = NULL;
  3859		int handle;
  3860		size_t rp_size = 0;
  3861		__u32 supported = 0;
  3862		__u16 num_handles = 0;
  3863		__u16 handles[HCI_MAX_ADV_MONITOR_NUM_HANDLES];
  3864	
  3865		BT_DBG("request for %s", hdev->name);
  3866	
  3867		hci_dev_lock(hdev);
  3868	
  3869		if (msft_get_features(hdev) & MSFT_FEATURE_MASK_LE_ADV_MONITOR)
  3870			supported |= MGMT_ADV_MONITOR_FEATURE_MASK_OR_PATTERNS;
  3871	
  3872		idr_for_each_entry(&hdev->adv_monitors_idr, monitor, handle) {
  3873			handles[num_handles++] = monitor->handle;
  3874		}
  3875	
  3876		hci_dev_unlock(hdev);
  3877	
  3878		rp_size = sizeof(*rp) + (num_handles * sizeof(u16));
  3879		rp = kmalloc(rp_size, GFP_KERNEL);
  3880		if (!rp)
  3881			return -ENOMEM;
  3882	
  3883		/* Once controller-based monitoring is in place, the enabled_features
  3884		 * should reflect the use.
  3885		 */
> 3886		rp->supported_features = cpu_to_le32(supported);
  3887		rp->enabled_features = 0;
> 3888		rp->max_num_handles = cpu_to_le16(HCI_MAX_ADV_MONITOR_NUM_HANDLES);
  3889		rp->max_num_patterns = HCI_MAX_ADV_MONITOR_NUM_PATTERNS;
> 3890		rp->num_handles = cpu_to_le16(num_handles);
  3891		if (num_handles)
  3892			memcpy(&rp->handles, &handles, (num_handles * sizeof(u16)));
  3893	
  3894		return mgmt_cmd_complete(sk, hdev->id,
  3895					 MGMT_OP_READ_ADV_MONITOR_FEATURES,
  3896					 MGMT_STATUS_SUCCESS, rp, rp_size);
  3897	}
  3898	

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

Attachment: .config.gz
Description: application/gzip


[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux