All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Daniel Borkmann <daniel@iogearbox.net>
Cc: oe-kbuild-all@lists.linux.dev, Daniel Borkmann <daniel@iogearbox.net>
Subject: [cilium:pr/wg 5/5] drivers/net/wireguard/socket.c:47:22: sparse: sparse: incorrect type in assignment (different base types)
Date: Thu, 31 Oct 2024 20:07:43 +0800	[thread overview]
Message-ID: <202410312046.GbR2BUGR-lkp@intel.com> (raw)

tree:   https://github.com/cilium/linux.git pr/wg
head:   9b148f25ed218ffbc73a3cdd9e91598c61082d32
commit: 9b148f25ed218ffbc73a3cdd9e91598c61082d32 [5/5] sport hashing
config: i386-randconfig-062-20241031 (https://download.01.org/0day-ci/archive/20241031/202410312046.GbR2BUGR-lkp@intel.com/config)
compiler: clang version 19.1.3 (https://github.com/llvm/llvm-project ab51eccf88f5321e7c60591c5546b254b6afab99)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241031/202410312046.GbR2BUGR-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202410312046.GbR2BUGR-lkp@intel.com/

sparse warnings: (new ones prefixed by >>)
>> drivers/net/wireguard/socket.c:47:22: sparse: sparse: incorrect type in assignment (different base types) @@     expected restricted __be16 [usertype] sport @@     got unsigned short [usertype] sport @@
   drivers/net/wireguard/socket.c:47:22: sparse:     expected restricted __be16 [usertype] sport
   drivers/net/wireguard/socket.c:47:22: sparse:     got unsigned short [usertype] sport
   drivers/net/wireguard/socket.c:126:22: sparse: sparse: incorrect type in assignment (different base types) @@     expected restricted __be16 [usertype] sport @@     got unsigned short [usertype] sport @@
   drivers/net/wireguard/socket.c:126:22: sparse:     expected restricted __be16 [usertype] sport
   drivers/net/wireguard/socket.c:126:22: sparse:     got unsigned short [usertype] sport
--
>> drivers/net/wireguard/send.c:174:31: sparse: sparse: incorrect type in assignment (different base types) @@     expected unsigned short [usertype] sport @@     got restricted __be16 @@
   drivers/net/wireguard/send.c:174:31: sparse:     expected unsigned short [usertype] sport
   drivers/net/wireguard/send.c:174:31: sparse:     got restricted __be16

vim +47 drivers/net/wireguard/socket.c

    20	
    21	static int send4(struct wg_device *wg, struct sk_buff *skb,
    22			 struct endpoint *endpoint, u8 ds, struct dst_cache *cache)
    23	{
    24		struct flowi4 fl = {
    25			.saddr = endpoint->src4.s_addr,
    26			.daddr = endpoint->addr4.sin_addr.s_addr,
    27			.fl4_dport = endpoint->addr4.sin_port,
    28			.flowi4_mark = wg->fwmark,
    29			.flowi4_proto = IPPROTO_UDP
    30		};
    31		struct rtable *rt = NULL;
    32		struct sock *sock;
    33		int ret = 0;
    34	
    35		skb_mark_not_on_list(skb);
    36		skb->dev = wg->dev;
    37		skb->mark = wg->fwmark;
    38	
    39		rcu_read_lock_bh();
    40		sock = rcu_dereference_bh(wg->sock4);
    41	
    42		if (unlikely(!sock)) {
    43			ret = -ENONET;
    44			goto err;
    45		}
    46	
  > 47		fl.fl4_sport = PACKET_CB(skb)->sport;
    48		if (cache)
    49			rt = dst_cache_get_ip4(cache, &fl.saddr);
    50	
    51		if (!rt) {
    52			security_sk_classify_flow(sock, flowi4_to_flowi_common(&fl));
    53			if (unlikely(!inet_confirm_addr(sock_net(sock), NULL, 0,
    54							fl.saddr, RT_SCOPE_HOST))) {
    55				endpoint->src4.s_addr = 0;
    56				endpoint->src_if4 = 0;
    57				fl.saddr = 0;
    58				if (cache)
    59					dst_cache_reset(cache);
    60			}
    61			rt = ip_route_output_flow(sock_net(sock), &fl, sock);
    62			if (unlikely(endpoint->src_if4 && ((IS_ERR(rt) &&
    63				     PTR_ERR(rt) == -EINVAL) || (!IS_ERR(rt) &&
    64				     rt->dst.dev->ifindex != endpoint->src_if4)))) {
    65				endpoint->src4.s_addr = 0;
    66				endpoint->src_if4 = 0;
    67				fl.saddr = 0;
    68				if (cache)
    69					dst_cache_reset(cache);
    70				if (!IS_ERR(rt))
    71					ip_rt_put(rt);
    72				rt = ip_route_output_flow(sock_net(sock), &fl, sock);
    73			}
    74			if (IS_ERR(rt)) {
    75				ret = PTR_ERR(rt);
    76				net_dbg_ratelimited("%s: No route to %pISpfsc, error %d\n",
    77						    wg->dev->name, &endpoint->addr, ret);
    78				goto err;
    79			}
    80			if (cache)
    81				dst_cache_set_ip4(cache, &rt->dst, fl.saddr);
    82		}
    83	
    84		skb->ignore_df = 1;
    85		udp_tunnel_xmit_skb(rt, sock, skb, fl.saddr, fl.daddr, ds,
    86				    ip4_dst_hoplimit(&rt->dst), 0, fl.fl4_sport,
    87				    fl.fl4_dport, false, false);
    88		goto out;
    89	
    90	err:
    91		kfree_skb(skb);
    92	out:
    93		rcu_read_unlock_bh();
    94		return ret;
    95	}
    96	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

                 reply	other threads:[~2024-10-31 12:08 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202410312046.GbR2BUGR-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=daniel@iogearbox.net \
    --cc=oe-kbuild-all@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.