lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202008011329.WoACRMn4%lkp@intel.com>
Date:   Sat, 1 Aug 2020 13:33:33 +0800
From:   kernel test robot <lkp@...el.com>
To:     Martin Varghese <martin.varghese@...ia.com>
Cc:     kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org
Subject: drivers/net/bareudp.c:274:45: warning: Clarify calculation
 precedence for '&' and

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@...el.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ