tree:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 
master
head:   11957be20ff68d7670cb979a1c3ea5482a44b370
commit: 0153167aebd0808fb90031dba07d4e696557474c [89/93] net/ipv6: Remove 
rt6i_prefsrc
reproduce:
        # apt-get install sparse
        git checkout 0153167aebd0808fb90031dba07d4e696557474c
        make ARCH=x86_64 allmodconfig
        make C=1 CF=-D__CHECK_ENDIAN__


sparse warnings: (new ones prefixed by >>)

>> drivers/scsi/cxgbi/libcxgbi.c:787:43: sparse: incorrect type in argument 1 
>> (different address spaces) @@    expected struct in6_addr const *a @@    got 
>> struct in6_struct in6_addr const *a @@
   drivers/scsi/cxgbi/libcxgbi.c:787:43:    expected struct in6_addr const *a
   drivers/scsi/cxgbi/libcxgbi.c:787:43:    got struct in6_addr [noderef] 
<asn:4>*<noident>
   drivers/scsi/cxgbi/libcxgbi.c:1040:21: sparse: restricted __wsum degrades to 
integer
   drivers/scsi/cxgbi/libcxgbi.c:1045:33: sparse: bad assignment (-=) to 
restricted __wsum
   drivers/scsi/cxgbi/libcxgbi.c:1049:33: sparse: invalid assignment: -=
   drivers/scsi/cxgbi/libcxgbi.c:1049:33:    left side has type unsigned int
   drivers/scsi/cxgbi/libcxgbi.c:1049:33:    right side has type restricted 
__wsum
   drivers/scsi/cxgbi/libcxgbi.h:396:19: sparse: invalid assignment: +=
   drivers/scsi/cxgbi/libcxgbi.h:396:19:    left side has type int
   drivers/scsi/cxgbi/libcxgbi.h:396:19:    right side has type restricted 
__wsum
   drivers/scsi/cxgbi/libcxgbi.c:1426:19: sparse: cast to restricted __be32
   drivers/scsi/cxgbi/libcxgbi.c:1426:19: sparse: cast to restricted __be32
   drivers/scsi/cxgbi/libcxgbi.c:1426:19: sparse: cast to restricted __be32
   drivers/scsi/cxgbi/libcxgbi.c:1426:19: sparse: cast to restricted __be32
   drivers/scsi/cxgbi/libcxgbi.c:1426:19: sparse: cast to restricted __be32
   drivers/scsi/cxgbi/libcxgbi.c:1426:19: sparse: cast to restricted __be32
   drivers/scsi/cxgbi/libcxgbi.c:1502:19: sparse: cast to restricted __be32
   drivers/scsi/cxgbi/libcxgbi.c:1502:19: sparse: cast to restricted __be32
   drivers/scsi/cxgbi/libcxgbi.c:1502:19: sparse: cast to restricted __be32
   drivers/scsi/cxgbi/libcxgbi.c:1502:19: sparse: cast to restricted __be32
   drivers/scsi/cxgbi/libcxgbi.c:1502:19: sparse: cast to restricted __be32
   drivers/scsi/cxgbi/libcxgbi.c:1502:19: sparse: cast to restricted __be32
   drivers/scsi/cxgbi/libcxgbi.c:1663:17: sparse: cast to restricted __be32
   drivers/scsi/cxgbi/libcxgbi.c:1663:17: sparse: cast from restricted itt_t
   drivers/scsi/cxgbi/libcxgbi.c:1663:17: sparse: cast to restricted __be32
   drivers/scsi/cxgbi/libcxgbi.c:1663:17: sparse: cast from restricted itt_t
   drivers/scsi/cxgbi/libcxgbi.c:1663:17: sparse: cast to restricted __be32
   drivers/scsi/cxgbi/libcxgbi.c:1663:17: sparse: cast from restricted itt_t
   drivers/scsi/cxgbi/libcxgbi.c:1663:17: sparse: cast to restricted __be32
   drivers/scsi/cxgbi/libcxgbi.c:1663:17: sparse: cast from restricted itt_t
   drivers/scsi/cxgbi/libcxgbi.c:1663:17: sparse: cast to restricted __be32
   drivers/scsi/cxgbi/libcxgbi.c:1663:17: sparse: cast from restricted itt_t
   drivers/scsi/cxgbi/libcxgbi.c:1663:17: sparse: cast to restricted __be32
   drivers/scsi/cxgbi/libcxgbi.c:1663:17: sparse: cast from restricted itt_t
   drivers/scsi/cxgbi/libcxgbi.c:1856:24: sparse: expression using sizeof(void)
   drivers/scsi/cxgbi/libcxgbi.c:1856:24: sparse: expression using sizeof(void)
   drivers/scsi/cxgbi/libcxgbi.c:1902:29: sparse: expression using sizeof(void)
   drivers/scsi/cxgbi/libcxgbi.c:1902:29: sparse: expression using sizeof(void)
   drivers/scsi/cxgbi/libcxgbi.c:1931:9: sparse: cast to restricted __be32
   drivers/scsi/cxgbi/libcxgbi.c:1931:9: sparse: cast from restricted itt_t
   drivers/scsi/cxgbi/libcxgbi.c:1931:9: sparse: cast to restricted __be32
   drivers/scsi/cxgbi/libcxgbi.c:1931:9: sparse: cast from restricted itt_t
   drivers/scsi/cxgbi/libcxgbi.c:1931:9: sparse: cast to restricted __be32
   drivers/scsi/cxgbi/libcxgbi.c:1931:9: sparse: cast from restricted itt_t
   drivers/scsi/cxgbi/libcxgbi.c:1931:9: sparse: cast to restricted __be32
   drivers/scsi/cxgbi/libcxgbi.c:1931:9: sparse: cast from restricted itt_t
   drivers/scsi/cxgbi/libcxgbi.c:1931:9: sparse: cast to restricted __be32
   drivers/scsi/cxgbi/libcxgbi.c:1931:9: sparse: cast from restricted itt_t
   drivers/scsi/cxgbi/libcxgbi.c:1931:9: sparse: cast to restricted __be32
   drivers/scsi/cxgbi/libcxgbi.c:1931:9: sparse: cast from restricted itt_t
   drivers/scsi/cxgbi/libcxgbi.c:1964:9: sparse: cast to restricted __be32
   drivers/scsi/cxgbi/libcxgbi.c:1964:9: sparse: cast from restricted itt_t
   drivers/scsi/cxgbi/libcxgbi.c:1964:9: sparse: cast to restricted __be32
   drivers/scsi/cxgbi/libcxgbi.c:1964:9: sparse: cast from restricted itt_t
   drivers/scsi/cxgbi/libcxgbi.c:1964:9: sparse: cast to restricted __be32
   drivers/scsi/cxgbi/libcxgbi.c:1964:9: sparse: cast from restricted itt_t
   drivers/scsi/cxgbi/libcxgbi.c:1964:9: sparse: cast to restricted __be32
   drivers/scsi/cxgbi/libcxgbi.c:1964:9: sparse: cast from restricted itt_t
   drivers/scsi/cxgbi/libcxgbi.c:1964:9: sparse: cast to restricted __be32
   drivers/scsi/cxgbi/libcxgbi.c:1964:9: sparse: cast from restricted itt_t
   drivers/scsi/cxgbi/libcxgbi.c:1964:9: sparse: cast to restricted __be32
   drivers/scsi/cxgbi/libcxgbi.c:1964:9: sparse: cast from restricted itt_t
   drivers/scsi/cxgbi/libcxgbi.c:2202:28: sparse: expression using sizeof(void)
   drivers/scsi/cxgbi/libcxgbi.c:2202:28: sparse: expression using sizeof(void)
   drivers/scsi/cxgbi/libcxgbi.c:2204:15: sparse: expression using sizeof(void)
   drivers/scsi/cxgbi/libcxgbi.c:2204:15: sparse: expression using sizeof(void)
   drivers/scsi/cxgbi/libcxgbi.c:2206:42: sparse: expression using sizeof(void)
   drivers/scsi/cxgbi/libcxgbi.c:2206:42: sparse: expression using sizeof(void)
   drivers/scsi/cxgbi/libcxgbi.c:2228:42: sparse: expression using sizeof(void)
   drivers/scsi/cxgbi/libcxgbi.c:2228:42: sparse: expression using sizeof(void)
>> drivers/scsi/cxgbi/libcxgbi.c:798:32: sparse: dereference of noderef 
>> expression

vim +787 drivers/scsi/cxgbi/libcxgbi.c

   710  
   711  static struct cxgbi_sock *
   712  cxgbi_check_route6(struct sockaddr *dst_addr, int ifindex)
   713  {
   714          struct sockaddr_in6 *daddr6 = (struct sockaddr_in6 *)dst_addr;
   715          struct dst_entry *dst;
   716          struct net_device *ndev;
   717          struct cxgbi_device *cdev;
   718          struct rt6_info *rt = NULL;
   719          struct neighbour *n;
   720          struct in6_addr pref_saddr;
   721          struct cxgbi_sock *csk = NULL;
   722          unsigned int mtu = 0;
   723          int port = 0xFFFF;
   724          int err = 0;
   725  
   726          rt = find_route_ipv6(NULL, &daddr6->sin6_addr, ifindex);
   727  
   728          if (!rt) {
   729                  pr_info("no route to ipv6 %pI6 port %u\n",
   730                          daddr6->sin6_addr.s6_addr,
   731                          be16_to_cpu(daddr6->sin6_port));
   732                  err = -ENETUNREACH;
   733                  goto err_out;
   734          }
   735  
   736          dst = &rt->dst;
   737  
   738          n = dst_neigh_lookup(dst, &daddr6->sin6_addr);
   739  
   740          if (!n) {
   741                  pr_info("%pI6, port %u, dst no neighbour.\n",
   742                          daddr6->sin6_addr.s6_addr,
   743                          be16_to_cpu(daddr6->sin6_port));
   744                  err = -ENETUNREACH;
   745                  goto rel_rt;
   746          }
   747          ndev = n->dev;
   748  
   749          if (!(ndev->flags & IFF_UP) || !netif_carrier_ok(ndev)) {
   750                  pr_info("%s interface not up.\n", ndev->name);
   751                  err = -ENETDOWN;
   752                  goto rel_rt;
   753          }
   754  
   755          if (ipv6_addr_is_multicast(&daddr6->sin6_addr)) {
   756                  pr_info("multi-cast route %pI6 port %u, dev %s.\n",
   757                          daddr6->sin6_addr.s6_addr,
   758                          ntohs(daddr6->sin6_port), ndev->name);
   759                  err = -ENETUNREACH;
   760                  goto rel_rt;
   761          }
   762  
   763          cdev = cxgbi_device_find_by_netdev(ndev, &port);
   764          if (!cdev)
   765                  cdev = cxgbi_device_find_by_mac(ndev, &port);
   766          if (!cdev) {
   767                  pr_info("dst %pI6 %s, NOT cxgbi device.\n",
   768                          daddr6->sin6_addr.s6_addr, ndev->name);
   769                  err = -ENETUNREACH;
   770                  goto rel_rt;
   771          }
   772          log_debug(1 << CXGBI_DBG_SOCK,
   773                    "route to %pI6 :%u, ndev p#%d,%s, cdev 0x%p.\n",
   774                    daddr6->sin6_addr.s6_addr, ntohs(daddr6->sin6_port), 
port,
   775                    ndev->name, cdev);
   776  
   777          csk = cxgbi_sock_create(cdev);
   778          if (!csk) {
   779                  err = -ENOMEM;
   780                  goto rel_rt;
   781          }
   782          csk->cdev = cdev;
   783          csk->port_id = port;
   784          csk->mtu = mtu;
   785          csk->dst = dst;
   786  
 > 787          if (!rt->from || ipv6_addr_any(&rt->from->fib6_prefsrc.addr)) {
   788                  struct inet6_dev *idev = ip6_dst_idev((struct dst_entry 
*)rt);
   789  
   790                  err = ipv6_dev_get_saddr(&init_net, idev ? idev->dev : 
NULL,
   791                                           &daddr6->sin6_addr, 0, 
&pref_saddr);
   792                  if (err) {
   793                          pr_info("failed to get source address to reach 
%pI6\n",
   794                                  &daddr6->sin6_addr);
   795                          goto rel_rt;
   796                  }
   797          } else {
 > 798                  pref_saddr = rt->from->fib6_prefsrc.addr;
   799          }
   800  
   801          csk->csk_family = AF_INET6;
   802          csk->daddr6.sin6_addr = daddr6->sin6_addr;
   803          csk->daddr6.sin6_port = daddr6->sin6_port;
   804          csk->daddr6.sin6_family = daddr6->sin6_family;
   805          csk->saddr6.sin6_family = daddr6->sin6_family;
   806          csk->saddr6.sin6_addr = pref_saddr;
   807  
   808          neigh_release(n);
   809          return csk;
   810  
   811  rel_rt:
   812          if (n)
   813                  neigh_release(n);
   814  
   815          ip6_rt_put(rt);
   816          if (csk)
   817                  cxgbi_sock_closed(csk);
   818  err_out:
   819          return ERR_PTR(err);
   820  }
   821  #endif /* IS_ENABLED(CONFIG_IPV6) */
   822  

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

Reply via email to