tree:
git://git.infradead.org/users/hch/misc.git sockptr
head: 65b86d5658a5bbb84fe436c27cf60a6efb6b5303
commit: 65b86d5658a5bbb84fe436c27cf60a6efb6b5303 [46/46] net: pass a sockptr_t into
->setsockopt
config: i386-randconfig-s002-20200716 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-14) 9.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.2-49-g707c5017-dirty
git checkout 65b86d5658a5bbb84fe436c27cf60a6efb6b5303
# save the attached .config to linux build tree
make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=i386
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/mptcp/protocol.c:1659:45: sparse: sparse: incorrect type in
argument 1 (different base types) @@ expected void [noderef] __user *p @@ got
union sockptr_t [usertype] optval @@
> net/mptcp/protocol.c:1659:45: sparse: expected void [noderef] __user *p
> net/mptcp/protocol.c:1659:45: sparse: got union sockptr_t [usertype] optval
net/mptcp/protocol.c:1531:24: sparse: sparse: context imbalance in
'mptcp_sk_clone' - unexpected unlock
--
net/decnet/af_decnet.c:1325:27: sparse: sparse: Expected ) in function declarator
net/decnet/af_decnet.c:1325:27: sparse: sparse: got optval
net/decnet/af_decnet.c:1340:9: sparse: sparse: Trying to use reserved word
'return' as identifier
net/decnet/af_decnet.c:1340:16: sparse: sparse: Expected ; at end of declaration
net/decnet/af_decnet.c:1340:16: sparse: sparse: got err
net/decnet/af_decnet.c:1341:1: sparse: sparse: Expected ; at the end of type
declaration
net/decnet/af_decnet.c:1341:1: sparse: sparse: got }
net/decnet/af_decnet.c:1360:20: sparse: sparse: Expected ) in function declarator
net/decnet/af_decnet.c:1360:20: sparse: sparse: got &&
net/decnet/af_decnet.c:1360:9: sparse: sparse: Trying to use reserved word 'if'
as identifier
net/decnet/af_decnet.c:1363:20: sparse: sparse: Expected ) in function declarator
net/decnet/af_decnet.c:1363:20: sparse: sparse: got >
net/decnet/af_decnet.c:1363:9: sparse: sparse: Trying to use reserved word 'if'
as identifier
net/decnet/af_decnet.c:1366:30: sparse: sparse: Expected ) in function declarator
net/decnet/af_decnet.c:1366:30: sparse: sparse: got (
net/decnet/af_decnet.c:1366:9: sparse: sparse: Trying to use reserved word 'if'
as identifier
net/decnet/af_decnet.c:1369:9: sparse: sparse: Trying to use reserved word
'switch' as identifier
net/decnet/af_decnet.c:1370:9: sparse: sparse: not in switch scope
net/decnet/af_decnet.c:1383:17: sparse: sparse: break/continue not in iterator scope
net/decnet/af_decnet.c:1385:9: sparse: sparse: not in switch scope
net/decnet/af_decnet.c:1397:17: sparse: sparse: break/continue not in iterator scope
net/decnet/af_decnet.c:1399:9: sparse: sparse: not in switch scope
net/decnet/af_decnet.c:1414:17: sparse: sparse: break/continue not in iterator scope
net/decnet/af_decnet.c:1416:9: sparse: sparse: not in switch scope
net/decnet/af_decnet.c:1429:17: sparse: sparse: break/continue not in iterator scope
net/decnet/af_decnet.c:1431:9: sparse: sparse: not in switch scope
net/decnet/af_decnet.c:1438:9: sparse: sparse: not in switch scope
net/decnet/af_decnet.c:1445:17: sparse: sparse: break/continue not in iterator scope
net/decnet/af_decnet.c:1447:9: sparse: sparse: not in switch scope
net/decnet/af_decnet.c:1457:17: sparse: sparse: break/continue not in iterator scope
net/decnet/af_decnet.c:1459:9: sparse: sparse: not in switch scope
net/decnet/af_decnet.c:1466:17: sparse: sparse: break/continue not in iterator scope
net/decnet/af_decnet.c:1468:9: sparse: sparse: not in switch scope
net/decnet/af_decnet.c:1475:17: sparse: sparse: break/continue not in iterator scope
net/decnet/af_decnet.c:1477:9: sparse: sparse: not in switch scope
net/decnet/af_decnet.c:1485:17: sparse: sparse: break/continue not in iterator scope
net/decnet/af_decnet.c:1487:9: sparse: sparse: not in switch scope
net/decnet/af_decnet.c:1493:17: sparse: sparse: break/continue not in iterator scope
net/decnet/af_decnet.c:1495:9: sparse: sparse: not in switch scope
net/decnet/af_decnet.c:1496:9: sparse: sparse: not in switch scope
net/decnet/af_decnet.c:1497:9: sparse: sparse: not in switch scope
net/decnet/af_decnet.c:1498:9: sparse: sparse: not in switch scope
net/decnet/af_decnet.c:1502:9: sparse: sparse: Trying to use reserved word
'return' as identifier
net/decnet/af_decnet.c:1502:16: sparse: sparse: Expected ; at end of declaration
net/decnet/af_decnet.c:1502:16: sparse: sparse: got 0
net/decnet/af_decnet.c:1503:1: sparse: sparse: Expected ; at the end of type
declaration
net/decnet/af_decnet.c:1503:1: sparse: sparse: got }
net/decnet/af_decnet.c:1528:9: sparse: sparse: Trying to use reserved word
'return' as identifier
net/decnet/af_decnet.c:1528:16: sparse: sparse: Expected ; at end of declaration
net/decnet/af_decnet.c:1528:16: sparse: sparse: got err
net/decnet/af_decnet.c:1529:1: sparse: sparse: Expected ; at the end of type
declaration
net/decnet/af_decnet.c:1529:1: sparse: sparse: got }
net/decnet/af_decnet.c:1540:12: sparse: sparse: Expected ) in function declarator
net/decnet/af_decnet.c:1540:12: sparse: sparse: got (
net/decnet/af_decnet.c:1540:9: sparse: sparse: Trying to use reserved word 'if'
as identifier
net/decnet/af_decnet.c:1540:12: sparse: sparse: Expected ) in function declarator
net/decnet/af_decnet.c:1540:12: sparse: sparse: got "net/decnet/af_decnet.c"
net/decnet/af_decnet.c:1540:12: sparse: sparse: Expected ) in function declarator
net/decnet/af_decnet.c:1540:12: sparse: sparse: got ,
net/decnet/af_decnet.c:1540:12: sparse: sparse: Expected ; at the end of type
declaration
net/decnet/af_decnet.c:1540:12: sparse: sparse: got }
net/decnet/af_decnet.c:1543:9: sparse: sparse: Trying to use reserved word
'switch' as identifier
net/decnet/af_decnet.c:1544:9: sparse: sparse: not in switch scope
net/decnet/af_decnet.c:1548:17: sparse: sparse: break/continue not in iterator scope
net/decnet/af_decnet.c:1550:9: sparse: sparse: not in switch scope
net/decnet/af_decnet.c:1554:17: sparse: sparse: break/continue not in iterator scope
net/decnet/af_decnet.c:1556:9: sparse: sparse: not in switch scope
net/decnet/af_decnet.c:1560:17: sparse: sparse: break/continue not in iterator scope
net/decnet/af_decnet.c:1562:9: sparse: sparse: not in switch scope
net/decnet/af_decnet.c:1566:17: sparse: sparse: break/continue not in iterator scope
net/decnet/af_decnet.c:1568:9: sparse: sparse: not in switch scope
net/decnet/af_decnet.c:1590:17: sparse: sparse: break/continue not in iterator scope
net/decnet/af_decnet.c:1592:9: sparse: sparse: not in switch scope
net/decnet/af_decnet.c:1596:17: sparse: sparse: break/continue not in iterator scope
net/decnet/af_decnet.c:1598:9: sparse: sparse: not in switch scope
net/decnet/af_decnet.c:1603:17: sparse: sparse: break/continue not in iterator scope
net/decnet/af_decnet.c:1605:9: sparse: sparse: not in switch scope
net/decnet/af_decnet.c:1610:17: sparse: sparse: break/continue not in iterator scope
net/decnet/af_decnet.c:1612:9: sparse: sparse: not in switch scope
net/decnet/af_decnet.c:1616:17: sparse: sparse: break/continue not in iterator scope
net/decnet/af_decnet.c:1618:9: sparse: sparse: not in switch scope
net/decnet/af_decnet.c:1622:17: sparse: sparse: break/continue not in iterator scope
net/decnet/af_decnet.c:1624:9: sparse: sparse: not in switch scope
net/decnet/af_decnet.c:1625:9: sparse: sparse: not in switch scope
net/decnet/af_decnet.c:1626:9: sparse: sparse: not in switch scope
net/decnet/af_decnet.c:1627:9: sparse: sparse: not in switch scope
net/decnet/af_decnet.c:1628:9: sparse: sparse: not in switch scope
net/decnet/af_decnet.c:1632:9: sparse: sparse: Trying to use reserved word 'if'
as identifier
net/decnet/af_decnet.c:1639:9: sparse: sparse: Trying to use reserved word
'return' as identifier
net/decnet/af_decnet.c:1639:16: sparse: sparse: Expected ; at end of declaration
net/decnet/af_decnet.c:1639:16: sparse: sparse: got 0
net/decnet/af_decnet.c:1640:1: sparse: sparse: Expected ; at the end of type
declaration
net/decnet/af_decnet.c:1640:1: sparse: sparse: got }
net/decnet/af_decnet.c:1648:19: sparse: sparse: Expected ) in function declarator
net/decnet/af_decnet.c:1648:19: sparse: sparse: got &
net/decnet/af_decnet.c:1648:9: sparse: sparse: Trying to use reserved word 'if'
as identifier
net/decnet/af_decnet.c:1651:9: sparse: sparse: Expected ) in function declarator
net/decnet/af_decnet.c:1651:9: sparse: sparse: got =
> net/decnet/af_decnet.c:1651:9: sparse: sparse: Trying to use
reserved word 'for' as identifier
net/decnet/af_decnet.c:1651:9: sparse:
sparse: Expected ; at end of declaration
net/decnet/af_decnet.c:1651:9: sparse: sparse: got !=
net/decnet/af_decnet.c:1651:9: sparse: sparse: too many errors
--
> net/dccp/proto.c:421:53: sparse: sparse: incorrect type in
argument 2 (different base types) @@ expected void const [noderef] __user *from @@
got union sockptr_t [usertype] optval @@
> net/dccp/proto.c:421:53: sparse: expected void const [noderef] __user *from
> net/dccp/proto.c:421:53: sparse: got union sockptr_t [usertype] optval
> net/dccp/proto.c:527:52: sparse: sparse: incorrect type in argument 2 (different base
types) @@ expected restricted __be32 const [usertype] service @@ got int
[addressable] val @@
net/dccp/proto.c:527:52: sparse: expected restricted
__be32 const [usertype] service
> net/dccp/proto.c:527:52: sparse: got int [addressable] val
> net/dccp/proto.c:571:71: sparse: sparse: incorrect type in argument 4 (invalid types)
@@ expected union sockptr_t [usertype] optval @@ got char [noderef] __user *optval
@@
> net/dccp/proto.c:571:71: sparse: expected union sockptr_t [usertype] optval
> net/dccp/proto.c:571:71: sparse: got char [noderef] __user *optval
net/dccp/proto.c:573:55: sparse: sparse: incorrect type in argument 4 (invalid types) @@
expected union sockptr_t [usertype] optval @@ got char [noderef] __user *optval @@
net/dccp/proto.c:573:55: sparse: expected union sockptr_t [usertype] optval
net/dccp/proto.c:573:55: sparse: got char [noderef] __user *optval
net/dccp/proto.c:566:5: sparse: sparse: symbol 'dccp_setsockopt' redeclared
with different type (incompatible argument 4 (different base types)):
> net/dccp/proto.c:566:5: sparse: int extern [addressable]
[signed] [toplevel] dccp_setsockopt( ... )
net/dccp/dccp.h:297:5: sparse: note:
previously declared as:
> net/dccp/dccp.h:297:5: sparse: int extern [addressable]
[signed] [toplevel] dccp_setsockopt( ... )
net/dccp/proto.c:710:57: sparse:
sparse: incorrect type in argument 2 (different base types) @@ expected restricted
__be32 [usertype] param @@ got int cmsg_type @@
net/dccp/proto.c:710:57: sparse: expected restricted __be32 [usertype] param
net/dccp/proto.c:710:57: sparse: got int cmsg_type
vim +1659 net/mptcp/protocol.c
79c0949e9a09f6 Peter Krystad 2020-01-21 1628
fd1452d8ef988d Florian Westphal 2020-07-05 1629 static int
mptcp_setsockopt_sol_socket(struct mptcp_sock *msk, int optname,
65b86d5658a5bb Christoph Hellwig 2020-07-16 1630 sockptr_t optval, unsigned
int optlen)
fd1452d8ef988d Florian Westphal 2020-07-05 1631 {
fd1452d8ef988d Florian Westphal 2020-07-05 1632 struct sock *sk = (struct sock *)msk;
fd1452d8ef988d Florian Westphal 2020-07-05 1633 struct socket *ssock;
fd1452d8ef988d Florian Westphal 2020-07-05 1634 int ret;
fd1452d8ef988d Florian Westphal 2020-07-05 1635
fd1452d8ef988d Florian Westphal 2020-07-05 1636 switch (optname) {
fd1452d8ef988d Florian Westphal 2020-07-05 1637 case SO_REUSEPORT:
fd1452d8ef988d Florian Westphal 2020-07-05 1638 case SO_REUSEADDR:
fd1452d8ef988d Florian Westphal 2020-07-05 1639 lock_sock(sk);
fd1452d8ef988d Florian Westphal 2020-07-05 1640 ssock = __mptcp_nmpc_socket(msk);
fd1452d8ef988d Florian Westphal 2020-07-05 1641 if (!ssock) {
fd1452d8ef988d Florian Westphal 2020-07-05 1642 release_sock(sk);
fd1452d8ef988d Florian Westphal 2020-07-05 1643 return -EINVAL;
fd1452d8ef988d Florian Westphal 2020-07-05 1644 }
fd1452d8ef988d Florian Westphal 2020-07-05 1645
65b86d5658a5bb Christoph Hellwig 2020-07-16 1646 ret = sock_setsockopt(ssock,
SOL_SOCKET, optname, optval,
65b86d5658a5bb Christoph Hellwig 2020-07-16 1647 optlen);
fd1452d8ef988d Florian Westphal 2020-07-05 1648 if (ret == 0) {
fd1452d8ef988d Florian Westphal 2020-07-05 1649 if (optname == SO_REUSEPORT)
fd1452d8ef988d Florian Westphal 2020-07-05 1650 sk->sk_reuseport =
ssock->sk->sk_reuseport;
fd1452d8ef988d Florian Westphal 2020-07-05 1651 else if (optname == SO_REUSEADDR)
fd1452d8ef988d Florian Westphal 2020-07-05 1652 sk->sk_reuse =
ssock->sk->sk_reuse;
fd1452d8ef988d Florian Westphal 2020-07-05 1653 }
fd1452d8ef988d Florian Westphal 2020-07-05 1654 release_sock(sk);
fd1452d8ef988d Florian Westphal 2020-07-05 1655 return ret;
fd1452d8ef988d Florian Westphal 2020-07-05 1656 }
fd1452d8ef988d Florian Westphal 2020-07-05 1657
1bc49241714c4e Christoph Hellwig 2020-07-16 1658 return
sock_setsockopt(sk->sk_socket, SOL_SOCKET, optname,
1bc49241714c4e Christoph Hellwig 2020-07-16 @1659 USER_SOCKPTR(optval),
optlen);
fd1452d8ef988d Florian Westphal 2020-07-05 1660 }
fd1452d8ef988d Florian Westphal 2020-07-05 1661
:::::: The code at line 1659 was first introduced by commit
:::::: 1bc49241714c4e3ee30a9081f589f0cb4a9cede2 net: switch sock_set_timeout to sockptr_t
:::::: TO: Christoph Hellwig <hch(a)lst.de>
:::::: CC: Christoph Hellwig <hch(a)lst.de>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org