lkml.org 
[lkml]   [2022]   [Aug]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
Subject[alobakin:ip_tunnel 31/36] net/ipv4/ipip.c:247:54: sparse: sparse: Using plain integer as NULL pointer
tree:   https://github.com/alobakin/linux ip_tunnel
head: f6d5ecb4aceaf8c0da5503832a20129ac8c935df
commit: d979e3037463d961efe6c673bed1e4cc496ab2ce [31/36] net, tunnels: convert __be16 tunnel flags to bitmaps
config: x86_64-randconfig-s021 (https://download.01.org/0day-ci/archive/20220814/202208141837.tcObXYYV-lkp@intel.com/config)
compiler: gcc-11 (Debian 11.3.0-3) 11.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.4-39-gce1a6720-dirty
# https://github.com/alobakin/linux/commit/d979e3037463d961efe6c673bed1e4cc496ab2ce
git remote add alobakin https://github.com/alobakin/linux
git fetch --no-tags alobakin ip_tunnel
git checkout d979e3037463d961efe6c673bed1e4cc496ab2ce
# save the config file
mkdir build_dir && cp config build_dir/.config
make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=x86_64 SHELL=/bin/bash net/ipv4/ net/ipv6/

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

sparse warnings: (new ones prefixed by >>)
>> net/ipv4/ipip.c:247:54: sparse: sparse: Using plain integer as NULL pointer
--
>> net/ipv6/ip6_tunnel.c:935:56: sparse: sparse: Using plain integer as NULL pointer

vim +247 net/ipv4/ipip.c

1b69e7e6c4da1e8 Simon Horman 2016-07-07 214
1b69e7e6c4da1e8 Simon Horman 2016-07-07 215 static int ipip_tunnel_rcv(struct sk_buff *skb, u8 ipproto)
^1da177e4c3f415 Linus Torvalds 2005-04-16 216 {
fd58156e456d9f6 Pravin B Shelar 2013-03-25 217 struct net *net = dev_net(skb->dev);
fd58156e456d9f6 Pravin B Shelar 2013-03-25 218 struct ip_tunnel_net *itn = net_generic(net, ipip_net_id);
d979e3037463d96 Alexander Lobakin 2022-05-04 219 IP_TUNNEL_DECLARE_FLAGS(flags) = { };
cfc7381b3002756 Alexei Starovoitov 2016-09-15 220 struct metadata_dst *tun_dst = NULL;
^1da177e4c3f415 Linus Torvalds 2005-04-16 221 struct ip_tunnel *tunnel;
3d7b46cd20e300b Pravin B Shelar 2013-06-17 222 const struct iphdr *iph;
3c97af99a5aa17f Eric Dumazet 2010-09-27 223
d979e3037463d96 Alexander Lobakin 2022-05-04 224 __set_bit(IP_TUNNEL_NO_KEY_BIT, flags);
d979e3037463d96 Alexander Lobakin 2022-05-04 225
3d7b46cd20e300b Pravin B Shelar 2013-06-17 226 iph = ip_hdr(skb);
d979e3037463d96 Alexander Lobakin 2022-05-04 227 tunnel = ip_tunnel_lookup(itn, skb->dev->ifindex, flags, iph->saddr,
d979e3037463d96 Alexander Lobakin 2022-05-04 228 iph->daddr, 0);
fd58156e456d9f6 Pravin B Shelar 2013-03-25 229 if (tunnel) {
1b69e7e6c4da1e8 Simon Horman 2016-07-07 230 const struct tnl_ptk_info *tpi;
1b69e7e6c4da1e8 Simon Horman 2016-07-07 231
1b69e7e6c4da1e8 Simon Horman 2016-07-07 232 if (tunnel->parms.iph.protocol != ipproto &&
1b69e7e6c4da1e8 Simon Horman 2016-07-07 233 tunnel->parms.iph.protocol != 0)
1b69e7e6c4da1e8 Simon Horman 2016-07-07 234 goto drop;
1b69e7e6c4da1e8 Simon Horman 2016-07-07 235
eccc1bb8d4b4cf6 stephen hemminger 2012-09-25 236 if (!xfrm4_policy_check(NULL, XFRM_POLICY_IN, skb))
eccc1bb8d4b4cf6 stephen hemminger 2012-09-25 237 goto drop;
1b69e7e6c4da1e8 Simon Horman 2016-07-07 238 #if IS_ENABLED(CONFIG_MPLS)
1b69e7e6c4da1e8 Simon Horman 2016-07-07 239 if (ipproto == IPPROTO_MPLS)
1b69e7e6c4da1e8 Simon Horman 2016-07-07 240 tpi = &mplsip_tpi;
1b69e7e6c4da1e8 Simon Horman 2016-07-07 241 else
1b69e7e6c4da1e8 Simon Horman 2016-07-07 242 #endif
1b69e7e6c4da1e8 Simon Horman 2016-07-07 243 tpi = &ipip_tpi;
1b69e7e6c4da1e8 Simon Horman 2016-07-07 244 if (iptunnel_pull_header(skb, 0, tpi->proto, false))
737e828bdbdaf2f Li Hongjun 2013-08-28 245 goto drop;
cfc7381b3002756 Alexei Starovoitov 2016-09-15 246 if (tunnel->collect_md) {
cfc7381b3002756 Alexei Starovoitov 2016-09-15 @247 tun_dst = ip_tun_rx_dst(skb, 0, 0, 0);
cfc7381b3002756 Alexei Starovoitov 2016-09-15 248 if (!tun_dst)
cfc7381b3002756 Alexei Starovoitov 2016-09-15 249 return 0;
cfc7381b3002756 Alexei Starovoitov 2016-09-15 250 }
7ad136fd288c0e0 Guillaume Nault 2021-06-25 251 skb_reset_mac_header(skb);
7ad136fd288c0e0 Guillaume Nault 2021-06-25 252
cfc7381b3002756 Alexei Starovoitov 2016-09-15 253 return ip_tunnel_rcv(tunnel, skb, tpi, tun_dst, log_ecn_error);
^1da177e4c3f415 Linus Torvalds 2005-04-16 254 }
^1da177e4c3f415 Linus Torvalds 2005-04-16 255
^1da177e4c3f415 Linus Torvalds 2005-04-16 256 return -1;
eccc1bb8d4b4cf6 stephen hemminger 2012-09-25 257
eccc1bb8d4b4cf6 stephen hemminger 2012-09-25 258 drop:
eccc1bb8d4b4cf6 stephen hemminger 2012-09-25 259 kfree_skb(skb);
eccc1bb8d4b4cf6 stephen hemminger 2012-09-25 260 return 0;
^1da177e4c3f415 Linus Torvalds 2005-04-16 261 }
^1da177e4c3f415 Linus Torvalds 2005-04-16 262

:::::: The code at line 247 was first introduced by commit
:::::: cfc7381b3002756b1dcada32979e942aa3126e31 ip_tunnel: add collect_md mode to IPIP tunnel

:::::: TO: Alexei Starovoitov <ast@fb.com>
:::::: CC: David S. Miller <davem@davemloft.net>

--
0-DAY CI Kernel Test Service
https://01.org/lkp

\
 
 \ /
  Last update: 2022-08-14 12:57    [W:0.063 / U:0.504 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site