* [bluetooth-next:master 4/9] net/bluetooth/l2cap_sock.c:1084:21: sparse: sparse: incorrect type in argument 1 (different address spaces)
@ 2020-05-19 0:32 kbuild test robot
0 siblings, 0 replies; only message in thread
From: kbuild test robot @ 2020-05-19 0:32 UTC (permalink / raw)
To: Luiz Augusto von Dentz; +Cc: kbuild-all, linux-bluetooth, Marcel Holtmann
[-- Attachment #1: Type: text/plain, Size: 13681 bytes --]
tree: https://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next.git master
head: 1e5479be46a70389e1059818a2e9358858eaa5fc
commit: 3ee7b7cd83900bb711efadbf16fa096a615a1566 [4/9] Bluetooth: Add BT_MODE socket option
config: sh-randconfig-s001-20200519 (attached as .config)
reproduce:
# apt-get install sparse
# sparse version: v0.6.1-193-gb8fad4bc-dirty
git checkout 3ee7b7cd83900bb711efadbf16fa096a615a1566
# save the attached .config to linux build tree
make C=1 ARCH=sh CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'
If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp@intel.com>
sparse warnings: (new ones prefixed by >>)
./arch/sh/include/generated/uapi/asm/unistd_32.h:411:37: sparse: sparse: no newline at end of file
net/bluetooth/l2cap_sock.c:428:13: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected int const *__gu_addr @@ got int [noderefint const *__gu_addr @@
net/bluetooth/l2cap_sock.c:428:13: sparse: expected int const *__gu_addr
net/bluetooth/l2cap_sock.c:428:13: sparse: got int [noderef] <asn:1> *optlen
net/bluetooth/l2cap_sock.c:428:13: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] <asn:1> * @@ got ] <asn:1> * @@
net/bluetooth/l2cap_sock.c:428:13: sparse: expected void const volatile [noderef] <asn:1> *
net/bluetooth/l2cap_sock.c:428:13: sparse: got int const *__gu_addr
net/bluetooth/l2cap_sock.c:553:13: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected int const *__gu_addr @@ got int [noderefint const *__gu_addr @@
net/bluetooth/l2cap_sock.c:553:13: sparse: expected int const *__gu_addr
net/bluetooth/l2cap_sock.c:553:13: sparse: got int [noderef] <asn:1> *optlen
net/bluetooth/l2cap_sock.c:553:13: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] <asn:1> * @@ got ] <asn:1> * @@
net/bluetooth/l2cap_sock.c:553:13: sparse: expected void const volatile [noderef] <asn:1> *
net/bluetooth/l2cap_sock.c:553:13: sparse: got int const *__gu_addr
net/bluetooth/l2cap_sock.c:785:21: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected unsigned int const *__gu_addr @@ got unsigned int [noderef] unsigned int const *__gu_addr @@
net/bluetooth/l2cap_sock.c:785:21: sparse: expected unsigned int const *__gu_addr
net/bluetooth/l2cap_sock.c:785:21: sparse: got unsigned int [noderef] [usertype] <asn:1> *
net/bluetooth/l2cap_sock.c:785:21: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] <asn:1> * @@ got [noderef] <asn:1> * @@
net/bluetooth/l2cap_sock.c:785:21: sparse: expected void const volatile [noderef] <asn:1> *
net/bluetooth/l2cap_sock.c:785:21: sparse: got unsigned int const *__gu_addr
net/bluetooth/l2cap_sock.c:942:21: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected unsigned int const *__gu_addr @@ got unsigned int [noderef] unsigned int const *__gu_addr @@
net/bluetooth/l2cap_sock.c:942:21: sparse: expected unsigned int const *__gu_addr
net/bluetooth/l2cap_sock.c:942:21: sparse: got unsigned int [noderef] [usertype] <asn:1> *
net/bluetooth/l2cap_sock.c:942:21: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] <asn:1> * @@ got [noderef] <asn:1> * @@
net/bluetooth/l2cap_sock.c:942:21: sparse: expected void const volatile [noderef] <asn:1> *
net/bluetooth/l2cap_sock.c:942:21: sparse: got unsigned int const *__gu_addr
net/bluetooth/l2cap_sock.c:957:21: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected unsigned int const *__gu_addr @@ got unsigned int [noderef] unsigned int const *__gu_addr @@
net/bluetooth/l2cap_sock.c:957:21: sparse: expected unsigned int const *__gu_addr
net/bluetooth/l2cap_sock.c:957:21: sparse: got unsigned int [noderef] [usertype] <asn:1> *
net/bluetooth/l2cap_sock.c:957:21: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] <asn:1> * @@ got [noderef] <asn:1> * @@
net/bluetooth/l2cap_sock.c:957:21: sparse: expected void const volatile [noderef] <asn:1> *
net/bluetooth/l2cap_sock.c:957:21: sparse: got unsigned int const *__gu_addr
net/bluetooth/l2cap_sock.c:1005:21: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected unsigned int const *__gu_addr @@ got unsigned int [noderef] unsigned int const *__gu_addr @@
net/bluetooth/l2cap_sock.c:1005:21: sparse: expected unsigned int const *__gu_addr
net/bluetooth/l2cap_sock.c:1005:21: sparse: got unsigned int [noderef] [usertype] <asn:1> *
net/bluetooth/l2cap_sock.c:1005:21: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] <asn:1> * @@ got [noderef] <asn:1> * @@
net/bluetooth/l2cap_sock.c:1005:21: sparse: expected void const volatile [noderef] <asn:1> *
net/bluetooth/l2cap_sock.c:1005:21: sparse: got unsigned int const *__gu_addr
net/bluetooth/l2cap_sock.c:1053:21: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected unsigned short const *__gu_addr @@ got unsigned short [noderefunsigned short const *__gu_addr @@
net/bluetooth/l2cap_sock.c:1053:21: sparse: expected unsigned short const *__gu_addr
net/bluetooth/l2cap_sock.c:1053:21: sparse: got unsigned short [noderef] [usertype] <asn:1> *
net/bluetooth/l2cap_sock.c:1053:21: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] <asn:1> * @@ got le [noderef] <asn:1> * @@
net/bluetooth/l2cap_sock.c:1053:21: sparse: expected void const volatile [noderef] <asn:1> *
net/bluetooth/l2cap_sock.c:1053:21: sparse: got unsigned short const *__gu_addr
net/bluetooth/l2cap_sock.c:1084:21: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected unsigned char const *__gu_addr @@ got unsigned char [noderef]unsigned char const *__gu_addr @@
net/bluetooth/l2cap_sock.c:1084:21: sparse: expected unsigned char const *__gu_addr
net/bluetooth/l2cap_sock.c:1084:21: sparse: got unsigned char [noderef] [usertype] <asn:1> *
>> net/bluetooth/l2cap_sock.c:1084:21: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] <asn:1> * @@ got e [noderef] <asn:1> * @@
net/bluetooth/l2cap_sock.c:1084:21: sparse: expected void const volatile [noderef] <asn:1> *
net/bluetooth/l2cap_sock.c:1084:21: sparse: got unsigned char const *__gu_addr
vim +1084 net/bluetooth/l2cap_sock.c
860
861 static int l2cap_sock_setsockopt(struct socket *sock, int level, int optname,
862 char __user *optval, unsigned int optlen)
863 {
864 struct sock *sk = sock->sk;
865 struct l2cap_chan *chan = l2cap_pi(sk)->chan;
866 struct bt_security sec;
867 struct bt_power pwr;
868 struct l2cap_conn *conn;
869 int len, err = 0;
870 u32 opt;
871
872 BT_DBG("sk %p", sk);
873
874 if (level == SOL_L2CAP)
875 return l2cap_sock_setsockopt_old(sock, optname, optval, optlen);
876
877 if (level != SOL_BLUETOOTH)
878 return -ENOPROTOOPT;
879
880 lock_sock(sk);
881
882 switch (optname) {
883 case BT_SECURITY:
884 if (chan->chan_type != L2CAP_CHAN_CONN_ORIENTED &&
885 chan->chan_type != L2CAP_CHAN_FIXED &&
886 chan->chan_type != L2CAP_CHAN_RAW) {
887 err = -EINVAL;
888 break;
889 }
890
891 sec.level = BT_SECURITY_LOW;
892
893 len = min_t(unsigned int, sizeof(sec), optlen);
894 if (copy_from_user((char *) &sec, optval, len)) {
895 err = -EFAULT;
896 break;
897 }
898
899 if (sec.level < BT_SECURITY_LOW ||
900 sec.level > BT_SECURITY_FIPS) {
901 err = -EINVAL;
902 break;
903 }
904
905 chan->sec_level = sec.level;
906
907 if (!chan->conn)
908 break;
909
910 conn = chan->conn;
911
912 /* change security for LE channels */
913 if (chan->scid == L2CAP_CID_ATT) {
914 if (smp_conn_security(conn->hcon, sec.level)) {
915 err = -EINVAL;
916 break;
917 }
918
919 set_bit(FLAG_PENDING_SECURITY, &chan->flags);
920 sk->sk_state = BT_CONFIG;
921 chan->state = BT_CONFIG;
922
923 /* or for ACL link */
924 } else if ((sk->sk_state == BT_CONNECT2 &&
925 test_bit(BT_SK_DEFER_SETUP, &bt_sk(sk)->flags)) ||
926 sk->sk_state == BT_CONNECTED) {
927 if (!l2cap_chan_check_security(chan, true))
928 set_bit(BT_SK_SUSPEND, &bt_sk(sk)->flags);
929 else
930 sk->sk_state_change(sk);
931 } else {
932 err = -EINVAL;
933 }
934 break;
935
936 case BT_DEFER_SETUP:
937 if (sk->sk_state != BT_BOUND && sk->sk_state != BT_LISTEN) {
938 err = -EINVAL;
939 break;
940 }
941
942 if (get_user(opt, (u32 __user *) optval)) {
943 err = -EFAULT;
944 break;
945 }
946
947 if (opt) {
948 set_bit(BT_SK_DEFER_SETUP, &bt_sk(sk)->flags);
949 set_bit(FLAG_DEFER_SETUP, &chan->flags);
950 } else {
951 clear_bit(BT_SK_DEFER_SETUP, &bt_sk(sk)->flags);
952 clear_bit(FLAG_DEFER_SETUP, &chan->flags);
953 }
954 break;
955
956 case BT_FLUSHABLE:
957 if (get_user(opt, (u32 __user *) optval)) {
958 err = -EFAULT;
959 break;
960 }
961
962 if (opt > BT_FLUSHABLE_ON) {
963 err = -EINVAL;
964 break;
965 }
966
967 if (opt == BT_FLUSHABLE_OFF) {
968 conn = chan->conn;
969 /* proceed further only when we have l2cap_conn and
970 No Flush support in the LM */
971 if (!conn || !lmp_no_flush_capable(conn->hcon->hdev)) {
972 err = -EINVAL;
973 break;
974 }
975 }
976
977 if (opt)
978 set_bit(FLAG_FLUSHABLE, &chan->flags);
979 else
980 clear_bit(FLAG_FLUSHABLE, &chan->flags);
981 break;
982
983 case BT_POWER:
984 if (chan->chan_type != L2CAP_CHAN_CONN_ORIENTED &&
985 chan->chan_type != L2CAP_CHAN_RAW) {
986 err = -EINVAL;
987 break;
988 }
989
990 pwr.force_active = BT_POWER_FORCE_ACTIVE_ON;
991
992 len = min_t(unsigned int, sizeof(pwr), optlen);
993 if (copy_from_user((char *) &pwr, optval, len)) {
994 err = -EFAULT;
995 break;
996 }
997
998 if (pwr.force_active)
999 set_bit(FLAG_FORCE_ACTIVE, &chan->flags);
1000 else
1001 clear_bit(FLAG_FORCE_ACTIVE, &chan->flags);
1002 break;
1003
1004 case BT_CHANNEL_POLICY:
1005 if (get_user(opt, (u32 __user *) optval)) {
1006 err = -EFAULT;
1007 break;
1008 }
1009
1010 if (opt > BT_CHANNEL_POLICY_AMP_PREFERRED) {
1011 err = -EINVAL;
1012 break;
1013 }
1014
1015 if (chan->mode != L2CAP_MODE_ERTM &&
1016 chan->mode != L2CAP_MODE_STREAMING) {
1017 err = -EOPNOTSUPP;
1018 break;
1019 }
1020
1021 chan->chan_policy = (u8) opt;
1022
1023 if (sk->sk_state == BT_CONNECTED &&
1024 chan->move_role == L2CAP_MOVE_ROLE_NONE)
1025 l2cap_move_start(chan);
1026
1027 break;
1028
1029 case BT_SNDMTU:
1030 if (!bdaddr_type_is_le(chan->src_type)) {
1031 err = -EINVAL;
1032 break;
1033 }
1034
1035 /* Setting is not supported as it's the remote side that
1036 * decides this.
1037 */
1038 err = -EPERM;
1039 break;
1040
1041 case BT_RCVMTU:
1042 if (!bdaddr_type_is_le(chan->src_type)) {
1043 err = -EINVAL;
1044 break;
1045 }
1046
1047 if (chan->mode == L2CAP_MODE_LE_FLOWCTL &&
1048 sk->sk_state == BT_CONNECTED) {
1049 err = -EISCONN;
1050 break;
1051 }
1052
1053 if (get_user(opt, (u16 __user *) optval)) {
1054 err = -EFAULT;
1055 break;
1056 }
1057
1058 if (chan->mode == L2CAP_MODE_EXT_FLOWCTL &&
1059 sk->sk_state == BT_CONNECTED)
1060 err = l2cap_chan_reconfigure(chan, opt);
1061 else
1062 chan->imtu = opt;
1063
1064 break;
1065
1066 case BT_MODE:
1067 if (!enable_ecred) {
1068 err = -ENOPROTOOPT;
1069 break;
1070 }
1071
1072 BT_DBG("sk->sk_state %u", sk->sk_state);
1073
1074 if (sk->sk_state != BT_BOUND) {
1075 err = -EINVAL;
1076 break;
1077 }
1078
1079 if (chan->chan_type != L2CAP_CHAN_CONN_ORIENTED) {
1080 err = -EINVAL;
1081 break;
1082 }
1083
> 1084 if (get_user(opt, (u8 __user *) optval)) {
1085 err = -EFAULT;
1086 break;
1087 }
1088
1089 BT_DBG("opt %u", opt);
1090
1091 err = l2cap_set_mode(chan, opt);
1092 if (err)
1093 break;
1094
1095 BT_DBG("mode 0x%2.2x", chan->mode);
1096
1097 break;
1098
1099 default:
1100 err = -ENOPROTOOPT;
1101 break;
1102 }
1103
1104 release_sock(sk);
1105 return err;
1106 }
1107
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 27384 bytes --]
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-05-19 0:35 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-19 0:32 [bluetooth-next:master 4/9] net/bluetooth/l2cap_sock.c:1084:21: sparse: sparse: incorrect type in argument 1 (different address spaces) kbuild test robot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).