linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* drivers/net/bareudp.c:274:45: warning: Clarify calculation precedence for '&' and
@ 2020-08-01  5:33 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2020-08-01  5:33 UTC (permalink / raw)
  To: Martin Varghese; +Cc: kbuild-all, linux-kernel

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   7dc6fd0f3b8404542718039f5de19fe56e474578
commit: 571912c69f0ed731bd1e071ade9dc7ca4aa52065 net: UDP tunnel encapsulation module for tunnelling different protocols like MPLS, IP, NSH etc.
date:   5 months ago
compiler: sparc-linux-gcc (GCC) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>


cppcheck warnings: (new ones prefixed by >>)

>> drivers/net/bareudp.c:274:45: warning: Clarify calculation precedence for '&' and '?'. [clarifyCalculation]
    df = key->tun_flags & TUNNEL_DONT_FRAGMENT ? htons(IP_DF) : 0;
                                               ^

vim +274 drivers/net/bareudp.c

   240	
   241	static int bareudp_xmit_skb(struct sk_buff *skb, struct net_device *dev,
   242				    struct bareudp_dev *bareudp,
   243				    const struct ip_tunnel_info *info)
   244	{
   245		bool xnet = !net_eq(bareudp->net, dev_net(bareudp->dev));
   246		bool use_cache = ip_tunnel_dst_cache_usable(skb, info);
   247		struct socket *sock = rcu_dereference(bareudp->sock);
   248		bool udp_sum = !!(info->key.tun_flags & TUNNEL_CSUM);
   249		const struct ip_tunnel_key *key = &info->key;
   250		struct rtable *rt;
   251		__be16 sport, df;
   252		int min_headroom;
   253		__u8 tos, ttl;
   254		__be32 saddr;
   255		int err;
   256	
   257		if (!sock)
   258			return -ESHUTDOWN;
   259	
   260		rt = ip_route_output_tunnel(skb, dev, bareudp->net, &saddr, info,
   261					    IPPROTO_UDP, use_cache);
   262	
   263		if (IS_ERR(rt))
   264			return PTR_ERR(rt);
   265	
   266		skb_tunnel_check_pmtu(skb, &rt->dst,
   267				      BAREUDP_IPV4_HLEN + info->options_len);
   268	
   269		sport = udp_flow_src_port(bareudp->net, skb,
   270					  bareudp->sport_min, USHRT_MAX,
   271					  true);
   272		tos = ip_tunnel_ecn_encap(key->tos, ip_hdr(skb), skb);
   273		ttl = key->ttl;
 > 274		df = key->tun_flags & TUNNEL_DONT_FRAGMENT ? htons(IP_DF) : 0;
   275		skb_scrub_packet(skb, xnet);
   276	
   277		if (!skb_pull(skb, skb_network_offset(skb)))
   278			goto free_dst;
   279	
   280		min_headroom = LL_RESERVED_SPACE(rt->dst.dev) + rt->dst.header_len +
   281			BAREUDP_BASE_HLEN + info->options_len + sizeof(struct iphdr);
   282	
   283		err = skb_cow_head(skb, min_headroom);
   284		if (unlikely(err))
   285			goto free_dst;
   286	
   287		err = udp_tunnel_handle_offloads(skb, udp_sum);
   288		if (err)
   289			goto free_dst;
   290	
   291		skb_set_inner_protocol(skb, bareudp->ethertype);
   292		udp_tunnel_xmit_skb(rt, sock->sk, skb, saddr, info->key.u.ipv4.dst,
   293				    tos, ttl, df, sport, bareudp->port,
   294				    !net_eq(bareudp->net, dev_net(bareudp->dev)),
   295				    !(info->key.tun_flags & TUNNEL_CSUM));
   296		return 0;
   297	
   298	free_dst:
   299		dst_release(&rt->dst);
   300		return err;
   301	}
   302	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-08-01  5:33 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-01  5:33 drivers/net/bareudp.c:274:45: warning: Clarify calculation precedence for '&' and kernel 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).