Re: [PATCH v2 3/3] bluetooth: implement read/set default system parameters mgmt

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

 



Hi Alain,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on bluetooth-next/master]
[also build test WARNING on next-20200610]
[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/Alain-Michaud/Support-reading-and-setting-default-system-parameters/20200611-040656
base:   https://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next.git master
config: x86_64-randconfig-s021-20200607 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-13) 9.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.1-247-gcadbd124-dirty
        # save the attached .config to linux build tree
        make W=1 C=1 ARCH=x86_64 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_config.c:35:17: sparse: sparse: incorrect type in initializer (different base types) @@     expected unsigned short [usertype] value @@     got restricted __le16 [usertype] @@
>> net/bluetooth/mgmt_config.c:35:17: sparse:     expected unsigned short [usertype] value
>> net/bluetooth/mgmt_config.c:35:17: sparse:     got restricted __le16 [usertype]
   net/bluetooth/mgmt_config.c:36:17: sparse: sparse: incorrect type in initializer (different base types) @@     expected unsigned short [usertype] value @@     got restricted __le16 [usertype] @@
   net/bluetooth/mgmt_config.c:36:17: sparse:     expected unsigned short [usertype] value
   net/bluetooth/mgmt_config.c:36:17: sparse:     got restricted __le16 [usertype]
   net/bluetooth/mgmt_config.c:37:17: sparse: sparse: incorrect type in initializer (different base types) @@     expected unsigned short [usertype] value @@     got restricted __le16 [usertype] @@
   net/bluetooth/mgmt_config.c:37:17: sparse:     expected unsigned short [usertype] value
   net/bluetooth/mgmt_config.c:37:17: sparse:     got restricted __le16 [usertype]
   net/bluetooth/mgmt_config.c:38:17: sparse: sparse: incorrect type in initializer (different base types) @@     expected unsigned short [usertype] value @@     got restricted __le16 [usertype] @@
   net/bluetooth/mgmt_config.c:38:17: sparse:     expected unsigned short [usertype] value
   net/bluetooth/mgmt_config.c:38:17: sparse:     got restricted __le16 [usertype]
   net/bluetooth/mgmt_config.c:39:17: sparse: sparse: incorrect type in initializer (different base types) @@     expected unsigned short [usertype] value @@     got restricted __le16 [usertype] @@
   net/bluetooth/mgmt_config.c:39:17: sparse:     expected unsigned short [usertype] value
   net/bluetooth/mgmt_config.c:39:17: sparse:     got restricted __le16 [usertype]
   net/bluetooth/mgmt_config.c:40:17: sparse: sparse: incorrect type in initializer (different base types) @@     expected unsigned short [usertype] value @@     got restricted __le16 [usertype] @@
   net/bluetooth/mgmt_config.c:40:17: sparse:     expected unsigned short [usertype] value
   net/bluetooth/mgmt_config.c:40:17: sparse:     got restricted __le16 [usertype]
   net/bluetooth/mgmt_config.c:41:17: sparse: sparse: incorrect type in initializer (different base types) @@     expected unsigned short [usertype] value @@     got restricted __le16 [usertype] @@
   net/bluetooth/mgmt_config.c:41:17: sparse:     expected unsigned short [usertype] value
   net/bluetooth/mgmt_config.c:41:17: sparse:     got restricted __le16 [usertype]
   net/bluetooth/mgmt_config.c:42:17: sparse: sparse: incorrect type in initializer (different base types) @@     expected unsigned short [usertype] value @@     got restricted __le16 [usertype] @@
   net/bluetooth/mgmt_config.c:42:17: sparse:     expected unsigned short [usertype] value
   net/bluetooth/mgmt_config.c:42:17: sparse:     got restricted __le16 [usertype]
   net/bluetooth/mgmt_config.c:43:17: sparse: sparse: incorrect type in initializer (different base types) @@     expected unsigned short [usertype] value @@     got restricted __le16 [usertype] @@
   net/bluetooth/mgmt_config.c:43:17: sparse:     expected unsigned short [usertype] value
   net/bluetooth/mgmt_config.c:43:17: sparse:     got restricted __le16 [usertype]
   net/bluetooth/mgmt_config.c:44:17: sparse: sparse: incorrect type in initializer (different base types) @@     expected unsigned short [usertype] value @@     got restricted __le16 [usertype] @@
   net/bluetooth/mgmt_config.c:44:17: sparse:     expected unsigned short [usertype] value
   net/bluetooth/mgmt_config.c:44:17: sparse:     got restricted __le16 [usertype]
   net/bluetooth/mgmt_config.c:45:17: sparse: sparse: incorrect type in initializer (different base types) @@     expected unsigned short [usertype] value @@     got restricted __le16 [usertype] @@
   net/bluetooth/mgmt_config.c:45:17: sparse:     expected unsigned short [usertype] value
   net/bluetooth/mgmt_config.c:45:17: sparse:     got restricted __le16 [usertype]
   net/bluetooth/mgmt_config.c:46:17: sparse: sparse: incorrect type in initializer (different base types) @@     expected unsigned short [usertype] value @@     got restricted __le16 [usertype] @@
   net/bluetooth/mgmt_config.c:46:17: sparse:     expected unsigned short [usertype] value
   net/bluetooth/mgmt_config.c:46:17: sparse:     got restricted __le16 [usertype]
   net/bluetooth/mgmt_config.c:47:17: sparse: sparse: incorrect type in initializer (different base types) @@     expected unsigned short [usertype] value @@     got restricted __le16 [usertype] @@
   net/bluetooth/mgmt_config.c:47:17: sparse:     expected unsigned short [usertype] value
   net/bluetooth/mgmt_config.c:47:17: sparse:     got restricted __le16 [usertype]
   net/bluetooth/mgmt_config.c:48:17: sparse: sparse: incorrect type in initializer (different base types) @@     expected unsigned short [usertype] value @@     got restricted __le16 [usertype] @@
   net/bluetooth/mgmt_config.c:48:17: sparse:     expected unsigned short [usertype] value
   net/bluetooth/mgmt_config.c:48:17: sparse:     got restricted __le16 [usertype]
   net/bluetooth/mgmt_config.c:49:17: sparse: sparse: incorrect type in initializer (different base types) @@     expected unsigned short [usertype] value @@     got restricted __le16 [usertype] @@
   net/bluetooth/mgmt_config.c:49:17: sparse:     expected unsigned short [usertype] value
   net/bluetooth/mgmt_config.c:49:17: sparse:     got restricted __le16 [usertype]
   net/bluetooth/mgmt_config.c:50:17: sparse: sparse: incorrect type in initializer (different base types) @@     expected unsigned short [usertype] value @@     got restricted __le16 [usertype] @@
   net/bluetooth/mgmt_config.c:50:17: sparse:     expected unsigned short [usertype] value
   net/bluetooth/mgmt_config.c:50:17: sparse:     got restricted __le16 [usertype]
   net/bluetooth/mgmt_config.c:51:17: sparse: sparse: incorrect type in initializer (different base types) @@     expected unsigned short [usertype] value @@     got restricted __le16 [usertype] @@
   net/bluetooth/mgmt_config.c:51:17: sparse:     expected unsigned short [usertype] value
   net/bluetooth/mgmt_config.c:51:17: sparse:     got restricted __le16 [usertype]
   net/bluetooth/mgmt_config.c:52:17: sparse: sparse: incorrect type in initializer (different base types) @@     expected unsigned short [usertype] value @@     got restricted __le16 [usertype] @@
   net/bluetooth/mgmt_config.c:52:17: sparse:     expected unsigned short [usertype] value
   net/bluetooth/mgmt_config.c:52:17: sparse:     got restricted __le16 [usertype]
   net/bluetooth/mgmt_config.c:53:17: sparse: sparse: incorrect type in initializer (different base types) @@     expected unsigned short [usertype] value @@     got restricted __le16 [usertype] @@
   net/bluetooth/mgmt_config.c:53:17: sparse:     expected unsigned short [usertype] value
   net/bluetooth/mgmt_config.c:53:17: sparse:     got restricted __le16 [usertype]
   net/bluetooth/mgmt_config.c:54:17: sparse: sparse: incorrect type in initializer (different base types) @@     expected unsigned short [usertype] value @@     got restricted __le16 [usertype] @@
   net/bluetooth/mgmt_config.c:54:17: sparse:     expected unsigned short [usertype] value
   net/bluetooth/mgmt_config.c:54:17: sparse:     got restricted __le16 [usertype]
   net/bluetooth/mgmt_config.c:55:17: sparse: sparse: incorrect type in initializer (different base types) @@     expected unsigned short [usertype] value @@     got restricted __le16 [usertype] @@
   net/bluetooth/mgmt_config.c:55:17: sparse:     expected unsigned short [usertype] value
   net/bluetooth/mgmt_config.c:55:17: sparse:     got restricted __le16 [usertype]
   net/bluetooth/mgmt_config.c:56:17: sparse: sparse: incorrect type in initializer (different base types) @@     expected unsigned short [usertype] value @@     got restricted __le16 [usertype] @@
   net/bluetooth/mgmt_config.c:56:17: sparse:     expected unsigned short [usertype] value
   net/bluetooth/mgmt_config.c:56:17: sparse:     got restricted __le16 [usertype]
   net/bluetooth/mgmt_config.c:57:17: sparse: sparse: incorrect type in initializer (different base types) @@     expected unsigned short [usertype] value @@     got restricted __le16 [usertype] @@
   net/bluetooth/mgmt_config.c:57:17: sparse:     expected unsigned short [usertype] value
   net/bluetooth/mgmt_config.c:57:17: sparse:     got restricted __le16 [usertype]
   net/bluetooth/mgmt_config.c:58:17: sparse: sparse: incorrect type in initializer (different base types) @@     expected unsigned short [usertype] value @@     got restricted __le16 [usertype] @@
   net/bluetooth/mgmt_config.c:58:17: sparse:     expected unsigned short [usertype] value
   net/bluetooth/mgmt_config.c:58:17: sparse:     got restricted __le16 [usertype]
   net/bluetooth/mgmt_config.c:59:17: sparse: sparse: incorrect type in initializer (different base types) @@     expected unsigned short [usertype] value @@     got restricted __le16 [usertype] @@
   net/bluetooth/mgmt_config.c:59:17: sparse:     expected unsigned short [usertype] value
   net/bluetooth/mgmt_config.c:59:17: sparse:     got restricted __le16 [usertype]
   net/bluetooth/mgmt_config.c:60:17: sparse: sparse: incorrect type in initializer (different base types) @@     expected unsigned short [usertype] value @@     got restricted __le16 [usertype] @@
   net/bluetooth/mgmt_config.c:60:17: sparse:     expected unsigned short [usertype] value
   net/bluetooth/mgmt_config.c:60:17: sparse:     got restricted __le16 [usertype]
   net/bluetooth/mgmt_config.c:61:17: sparse: sparse: incorrect type in initializer (different base types) @@     expected unsigned short [usertype] value @@     got restricted __le16 [usertype] @@
   net/bluetooth/mgmt_config.c:61:17: sparse:     expected unsigned short [usertype] value
   net/bluetooth/mgmt_config.c:61:17: sparse:     got restricted __le16 [usertype]
>> net/bluetooth/mgmt_config.c:92:34: sparse: sparse: cast to restricted __le16
   net/bluetooth/mgmt_config.c:156:34: sparse: sparse: cast to restricted __le16
   net/bluetooth/mgmt_config.c:160:52: sparse: sparse: cast to restricted __le16
   net/bluetooth/mgmt_config.c:163:51: sparse: sparse: cast to restricted __le16
   net/bluetooth/mgmt_config.c:166:54: sparse: sparse: cast to restricted __le16
   net/bluetooth/mgmt_config.c:169:51: sparse: sparse: cast to restricted __le16
   net/bluetooth/mgmt_config.c:172:50: sparse: sparse: cast to restricted __le16
   net/bluetooth/mgmt_config.c:175:53: sparse: sparse: cast to restricted __le16
   net/bluetooth/mgmt_config.c:178:45: sparse: sparse: cast to restricted __le16
   net/bluetooth/mgmt_config.c:181:50: sparse: sparse: cast to restricted __le16
   net/bluetooth/mgmt_config.c:184:52: sparse: sparse: cast to restricted __le16
   net/bluetooth/mgmt_config.c:187:52: sparse: sparse: cast to restricted __le16
   net/bluetooth/mgmt_config.c:190:53: sparse: sparse: cast to restricted __le16
   net/bluetooth/mgmt_config.c:193:53: sparse: sparse: cast to restricted __le16
   net/bluetooth/mgmt_config.c:197:60: sparse: sparse: cast to restricted __le16
   net/bluetooth/mgmt_config.c:200:50: sparse: sparse: cast to restricted __le16
   net/bluetooth/mgmt_config.c:203:48: sparse: sparse: cast to restricted __le16
   net/bluetooth/mgmt_config.c:206:53: sparse: sparse: cast to restricted __le16
   net/bluetooth/mgmt_config.c:209:56: sparse: sparse: cast to restricted __le16
   net/bluetooth/mgmt_config.c:212:55: sparse: sparse: cast to restricted __le16
   net/bluetooth/mgmt_config.c:215:58: sparse: sparse: cast to restricted __le16
   net/bluetooth/mgmt_config.c:218:57: sparse: sparse: cast to restricted __le16
   net/bluetooth/mgmt_config.c:221:60: sparse: sparse: cast to restricted __le16
   net/bluetooth/mgmt_config.c:224:53: sparse: sparse: cast to restricted __le16
   net/bluetooth/mgmt_config.c:227:56: sparse: sparse: cast to restricted __le16
   net/bluetooth/mgmt_config.c:230:54: sparse: sparse: cast to restricted __le16
   net/bluetooth/mgmt_config.c:233:54: sparse: sparse: cast to restricted __le16
   net/bluetooth/mgmt_config.c:236:49: sparse: sparse: cast to restricted __le16
   net/bluetooth/mgmt_config.c:239:49: sparse: sparse: cast to restricted __le16

vim +35 net/bluetooth/mgmt_config.c

    19	
    20	int read_def_system_config(struct sock *sk, struct hci_dev *hdev, void *data,
    21				   u16 data_len)
    22	{
    23		struct {
    24			struct mgmt_tlv entry;
    25			union {
    26				/* This is a simplification for now since all values
    27				 * are 16 bits.  In the future, this code may need
    28				 * refactoring to account for variable length values
    29				 * and properly calculate the required buffer size.
    30				 */
    31				u16 value;
    32			};
    33		} __packed params[] = {
    34			/* Please see mgmt-api.txt for documentation of these values */
  > 35			HDEV_PARAM_U16(0x0000, def_page_scan_type),
    36			HDEV_PARAM_U16(0x0001, def_page_scan_int),
    37			HDEV_PARAM_U16(0x0002, def_page_scan_window),
    38			HDEV_PARAM_U16(0x0003, def_inq_scan_type),
    39			HDEV_PARAM_U16(0x0004, def_inq_scan_int),
    40			HDEV_PARAM_U16(0x0005, def_inq_scan_window),
    41			HDEV_PARAM_U16(0x0006, def_br_lsto),
    42			HDEV_PARAM_U16(0x0007, def_page_timeout),
    43			HDEV_PARAM_U16(0x0008, sniff_min_interval),
    44			HDEV_PARAM_U16(0x0009, sniff_max_interval),
    45			HDEV_PARAM_U16(0x000a, le_adv_min_interval),
    46			HDEV_PARAM_U16(0x000b, le_adv_max_interval),
    47			HDEV_PARAM_U16(0x000c, def_multi_adv_rotation_duration),
    48			HDEV_PARAM_U16(0x000d, le_scan_interval),
    49			HDEV_PARAM_U16(0x000e, le_scan_window),
    50			HDEV_PARAM_U16(0x000f, le_scan_int_suspend),
    51			HDEV_PARAM_U16(0x0010, le_scan_window_suspend),
    52			HDEV_PARAM_U16(0x0011, le_scan_int_discovery),
    53			HDEV_PARAM_U16(0x0012, le_scan_window_discovery),
    54			HDEV_PARAM_U16(0x0013, le_scan_int_adv_monitor),
    55			HDEV_PARAM_U16(0x0014, le_scan_window_adv_monitor),
    56			HDEV_PARAM_U16(0x0015, le_scan_int_connect),
    57			HDEV_PARAM_U16(0x0016, le_scan_window_connect),
    58			HDEV_PARAM_U16(0x0017, le_conn_min_interval),
  > 59			HDEV_PARAM_U16(0x0018, le_conn_max_interval),
    60			HDEV_PARAM_U16(0x0019, le_conn_latency),
    61			HDEV_PARAM_U16(0x001a, le_supv_timeout),
    62		};
    63		struct mgmt_rp_read_def_system_config *rp = (void *)params;
    64	
    65		bt_dev_dbg(hdev, "sock %p", sk);
    66	
    67		return mgmt_cmd_complete(sk, hdev->id,
    68					 MGMT_OP_READ_DEF_SYSTEM_CONFIG,
    69					 0, rp, sizeof(params));
    70	}
    71	
    72	#define TO_TLV(x)		((struct mgmt_tlv *)(x))
    73	#define TLV_GET_LE16(tlv)	le16_to_cpu(*((u16 *)(TO_TLV(tlv)->value)))
    74	
    75	int set_def_system_config(struct sock *sk, struct hci_dev *hdev, void *data,
    76				  u16 data_len)
    77	{
    78		u16 buffer_left = data_len;
    79		u8 *buffer = data;
    80	
    81		if (buffer_left < sizeof(struct mgmt_tlv)) {
    82			return mgmt_cmd_status(sk, hdev->id,
    83					       MGMT_OP_SET_DEF_SYSTEM_CONFIG,
    84					       MGMT_STATUS_INVALID_PARAMS);
    85		}
    86	
    87		/* First pass to validate the tlv */
    88		while (buffer_left >= sizeof(struct mgmt_tlv)) {
    89			const u8 len = TO_TLV(buffer)->length;
    90			const u16 exp_len = sizeof(struct mgmt_tlv) +
    91					    len;
  > 92			const u16 type = le16_to_cpu(TO_TLV(buffer)->type);

---
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