Re: [PATCHv2 net-next 09/17] sctp: add SCTP_REMOTE_UDP_ENCAPS_PORT sockopt
From: kernel test robot <hidden>
Date: 2020-10-08 13:10:47
Also in:
linux-sctp, oe-kbuild-all
Hi Xin, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on net-next/master] url: https://github.com/0day-ci/linux/commits/Xin-Long/sctp-Implement-RFC6951-UDP-Encapsulation-of-SCTP/20201008-175211 base: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 9faebeb2d80065926dfbc09cb73b1bb7779a89cd config: i386-randconfig-s002-20201008 (attached as .config) compiler: gcc-9 (Debian 9.3.0-15) 9.3.0 reproduce: # apt-get install sparse # sparse version: v0.6.2-218-gc0e96d6d-dirty # https://github.com/0day-ci/linux/commit/5f37023ae66b1c3df726e16ec30b9443394e1ed3 git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Xin-Long/sctp-Implement-RFC6951-UDP-Encapsulation-of-SCTP/20201008-175211 git checkout 5f37023ae66b1c3df726e16ec30b9443394e1ed3 # 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 <redacted> echo echo "sparse warnings: (new ones prefixed by >>)" echo net/sctp/socket.c: note: in included file (through include/net/sctp/sctp.h): include/net/sctp/structs.h:333:41: sparse: sparse: array of flexible structures
quoted
net/sctp/socket.c:4439:31: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __be16 [usertype] encap_port @@ got unsigned short [usertype] sue_port @@ net/sctp/socket.c:4439:31: sparse: expected restricted __be16 [usertype] encap_port net/sctp/socket.c:4439:31: sparse: got unsigned short [usertype] sue_port
net/sctp/socket.c:4458:39: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __be16 [usertype] encap_port @@ got unsigned short [usertype] sue_port @@ net/sctp/socket.c:4458:39: sparse: expected restricted __be16 [usertype] encap_port net/sctp/socket.c:4458:39: sparse: got unsigned short [usertype] sue_port net/sctp/socket.c:4463:33: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __be16 [usertype] encap_port @@ got unsigned short [usertype] sue_port @@ net/sctp/socket.c:4463:33: sparse: expected restricted __be16 [usertype] encap_port net/sctp/socket.c:4463:33: sparse: got unsigned short [usertype] sue_port
quoted
net/sctp/socket.c:7869:32: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned short [addressable] [usertype] sue_port @@ got restricted __be16 [usertype] encap_port @@ net/sctp/socket.c:7869:32: sparse: expected unsigned short [addressable] [usertype] sue_port net/sctp/socket.c:7869:32: sparse: got restricted __be16 [usertype] encap_port
net/sctp/socket.c:7885:32: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned short [addressable] [usertype] sue_port @@ got restricted __be16 [usertype] encap_port @@
net/sctp/socket.c:7885:32: sparse: expected unsigned short [addressable] [usertype] sue_port
net/sctp/socket.c:7885:32: sparse: got restricted __be16 [usertype] encap_port
net/sctp/socket.c:7889:24: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned short [addressable] [usertype] sue_port @@ got restricted __be16 [usertype] encap_port @@
net/sctp/socket.c:7889:24: sparse: expected unsigned short [addressable] [usertype] sue_port
net/sctp/socket.c:7889:24: sparse: got restricted __be16 [usertype] encap_port
net/sctp/socket.c:8320:23: sparse: sparse: context imbalance in 'sctp_get_port_local' - unexpected unlock
vim +4439 net/sctp/socket.c
4419
4420 static int sctp_setsockopt_encap_port(struct sock *sk,
4421 struct sctp_udpencaps *encap,
4422 unsigned int optlen)
4423 {
4424 struct sctp_association *asoc;
4425 struct sctp_transport *t;
4426
4427 if (optlen != sizeof(*encap))
4428 return -EINVAL;
4429
4430 /* If an address other than INADDR_ANY is specified, and
4431 * no transport is found, then the request is invalid.
4432 */
4433 if (!sctp_is_any(sk, (union sctp_addr *)&encap->sue_address)) {
4434 t = sctp_addr_id2transport(sk, &encap->sue_address,
4435 encap->sue_assoc_id);
4436 if (!t)
4437 return -EINVAL;
4438 4439 t->encap_port = encap->sue_port;
4440 return 0;
4441 }
4442
4443 /* Get association, if assoc_id != SCTP_FUTURE_ASSOC and the
4444 * socket is a one to many style socket, and an association
4445 * was not found, then the id was invalid.
4446 */
4447 asoc = sctp_id2assoc(sk, encap->sue_assoc_id);
4448 if (!asoc && encap->sue_assoc_id != SCTP_FUTURE_ASSOC &&
4449 sctp_style(sk, UDP))
4450 return -EINVAL;
4451
4452 /* If changes are for association, also apply encap to each
4453 * transport.
4454 */
4455 if (asoc) {
4456 list_for_each_entry(t, &asoc->peer.transport_addr_list,
4457 transports)
4458 t->encap_port = encap->sue_port;
4459
4460 return 0;
4461 }
4462
4463 sctp_sk(sk)->encap_port = encap->sue_port;
4464 return 0;
4465 }
4466
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org Attachments
- .config.gz [application/gzip] 30577 bytes