tree:
https://chromium.googlesource.com/chromiumos/third_party/kernel chromeos-5.10
head: 2aafbed9832f90f66592f9055153c2e3cfcfddce
commit: bc39abd88544ee7d44a374986c944d713d130a1e [45/46] CHROMIUM: Use link policies to
disallow role switches
config: m68k-randconfig-s032-20210409 (attached as .config)
compiler: m68k-linux-gcc (GCC) 9.3.0
reproduce:
wget
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O
~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.3-279-g6d5d9b42-dirty
git remote add chrome-os
https://chromium.googlesource.com/chromiumos/third_party/kernel
git fetch --no-tags chrome-os chromeos-5.10
git checkout bc39abd88544ee7d44a374986c944d713d130a1e
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1
CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=m68k
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
sparse warnings: (new ones prefixed by >>)
> net/bluetooth/hci_event.c:2714:35: sparse: sparse: incorrect type
in assignment (different base types) @@ expected restricted __le16 [assigned]
[usertype] policy @@ got unsigned short [usertype] link_policy @@
net/bluetooth/hci_event.c:2714:35: sparse: expected restricted __le16 [assigned]
[usertype] policy
net/bluetooth/hci_event.c:2714:35: sparse: got unsigned short [usertype]
link_policy
vim +2714 net/bluetooth/hci_event.c
2632
2633 static void hci_conn_complete_evt(struct hci_dev *hdev, struct sk_buff *skb)
2634 {
2635 struct hci_ev_conn_complete *ev = (void *) skb->data;
2636 struct hci_conn *conn;
2637
2638 BT_DBG("%s", hdev->name);
2639
2640 hci_dev_lock(hdev);
2641
2642 conn = hci_conn_hash_lookup_ba(hdev, ev->link_type, &ev->bdaddr);
2643 if (!conn) {
2644 /* Connection may not exist if auto-connected. Check the bredr
2645 * allowlist to see if this device is allowed to auto connect.
2646 * If link is an ACL type, create a connection class
2647 * automatically.
2648 *
2649 * Auto-connect will only occur if the event filter is
2650 * programmed with a given address. Right now, event filter is
2651 * only used during suspend.
2652 */
2653 if (ev->link_type == ACL_LINK &&
2654 hci_bdaddr_list_lookup_with_flags(&hdev->whitelist,
2655 &ev->bdaddr,
2656 BDADDR_BREDR)) {
2657 conn = hci_conn_add(hdev, ev->link_type, &ev->bdaddr,
2658 HCI_ROLE_SLAVE);
2659 if (!conn) {
2660 bt_dev_err(hdev, "no memory for new conn");
2661 goto unlock;
2662 }
2663 } else {
2664 if (ev->link_type != SCO_LINK)
2665 goto unlock;
2666
2667 conn = hci_conn_hash_lookup_ba(hdev, ESCO_LINK,
2668 &ev->bdaddr);
2669 if (!conn)
2670 goto unlock;
2671
2672 conn->type = SCO_LINK;
2673 }
2674 }
2675
2676 if (!ev->status) {
2677 int mask = hdev->link_mode;
2678 __u8 flags = 0;
2679
2680 mask |= hci_proto_connect_ind(hdev, &ev->bdaddr, ev->link_type,
2681 &flags);
2682
2683 conn->handle = __le16_to_cpu(ev->handle);
2684
2685 if (conn->type == ACL_LINK) {
2686 conn->state = BT_CONFIG;
2687 hci_conn_hold(conn);
2688
2689 if (!conn->out && !hci_conn_ssp_enabled(conn) &&
2690 !hci_find_link_key(hdev, &ev->bdaddr))
2691 conn->disc_timeout = HCI_PAIRING_TIMEOUT;
2692 else
2693 conn->disc_timeout = HCI_DISCONN_TIMEOUT;
2694 } else
2695 conn->state = BT_CONNECTED;
2696
2697 hci_debugfs_create_conn(conn);
2698 hci_conn_add_sysfs(conn);
2699
2700 if (test_bit(HCI_AUTH, &hdev->flags))
2701 set_bit(HCI_CONN_AUTH, &conn->flags);
2702
2703 if (test_bit(HCI_ENCRYPT, &hdev->flags))
2704 set_bit(HCI_CONN_ENCRYPT, &conn->flags);
2705
2706 /* Attempt to remain in the central role if preferred */
2707 if ((conn->mode == HCI_ROLE_MASTER && (mask & HCI_LM_MASTER))
&&
2708 (conn->link_policy & HCI_LP_RSWITCH)) {
2709 struct hci_cp_write_link_policy cp;
2710
2711 conn->link_policy &= ~HCI_LP_RSWITCH;
2712
2713 cp.handle = ev->handle;
2714 cp.policy = conn->link_policy;
2715 hci_send_cmd(hdev, HCI_OP_WRITE_LINK_POLICY,
2716 sizeof(cp), &cp);
2717 }
2718
2719 /* Get remote features */
2720 if (conn->type == ACL_LINK) {
2721 struct hci_cp_read_remote_features cp;
2722 cp.handle = ev->handle;
2723 hci_send_cmd(hdev, HCI_OP_READ_REMOTE_FEATURES,
2724 sizeof(cp), &cp);
2725
2726 hci_req_update_scan(hdev);
2727 }
2728
2729 /* Set packet type for incoming connection */
2730 if (!conn->out && hdev->hci_ver < BLUETOOTH_VER_2_0) {
2731 struct hci_cp_change_conn_ptype cp;
2732 cp.handle = ev->handle;
2733 cp.pkt_type = cpu_to_le16(conn->pkt_type);
2734 hci_send_cmd(hdev, HCI_OP_CHANGE_CONN_PTYPE, sizeof(cp),
2735 &cp);
2736 }
2737 } else {
2738 conn->state = BT_CLOSED;
2739 if (conn->type == ACL_LINK)
2740 mgmt_connect_failed(hdev, &conn->dst, conn->type,
2741 conn->dst_type, ev->status);
2742 }
2743
2744 if (conn->type == ACL_LINK)
2745 hci_sco_setup(conn, ev->status);
2746
2747 if (ev->status) {
2748 hci_connect_cfm(conn, ev->status);
2749 hci_conn_del(conn);
2750 } else if (ev->link_type == SCO_LINK) {
2751 switch (conn->setting & SCO_AIRMODE_MASK) {
2752 case SCO_AIRMODE_CVSD:
2753 if (hdev->notify)
2754 hdev->notify(hdev, HCI_NOTIFY_ENABLE_SCO_CVSD);
2755 break;
2756 }
2757
2758 hci_connect_cfm(conn, ev->status);
2759 }
2760
2761 unlock:
2762 hci_dev_unlock(hdev);
2763
2764 hci_conn_check_pending(hdev);
2765 }
2766
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org