[alobakin:ip_tunnel 31/36] net/ipv4/ip_tunnel_core.c:151:51: sparse: sparse: Using plain integer as NULL pointer

From: kernel test robot
Date: Sun Aug 14 2022 - 06:58:10 EST


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-s022 (https://download.01.org/0day-ci/archive/20220814/202208141847.or6l2m39-lkp@xxxxxxxxx/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/

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

sparse warnings: (new ones prefixed by >>)
>> net/ipv4/ip_tunnel_core.c:151:51: sparse: sparse: Using plain integer as NULL pointer

vim +151 net/ipv4/ip_tunnel_core.c

2d26f0a3c0e22f Eric Dumazet 2013-10-19 124
63d008a4e9ee86 Jiri Benc 2015-09-22 125 struct metadata_dst *iptunnel_metadata_reply(struct metadata_dst *md,
63d008a4e9ee86 Jiri Benc 2015-09-22 126 gfp_t flags)
63d008a4e9ee86 Jiri Benc 2015-09-22 127 {
63d008a4e9ee86 Jiri Benc 2015-09-22 128 struct metadata_dst *res;
63d008a4e9ee86 Jiri Benc 2015-09-22 129 struct ip_tunnel_info *dst, *src;
63d008a4e9ee86 Jiri Benc 2015-09-22 130
3fcece12bc1b6d Jakub Kicinski 2017-06-23 131 if (!md || md->type != METADATA_IP_TUNNEL ||
3fcece12bc1b6d Jakub Kicinski 2017-06-23 132 md->u.tun_info.mode & IP_TUNNEL_INFO_TX)
63d008a4e9ee86 Jiri Benc 2015-09-22 133 return NULL;
63d008a4e9ee86 Jiri Benc 2015-09-22 134
f52f11ec8ad49f Xin Long 2019-11-06 135 src = &md->u.tun_info;
f52f11ec8ad49f Xin Long 2019-11-06 136 res = metadata_dst_alloc(src->options_len, METADATA_IP_TUNNEL, flags);
63d008a4e9ee86 Jiri Benc 2015-09-22 137 if (!res)
63d008a4e9ee86 Jiri Benc 2015-09-22 138 return NULL;
63d008a4e9ee86 Jiri Benc 2015-09-22 139
63d008a4e9ee86 Jiri Benc 2015-09-22 140 dst = &res->u.tun_info;
63d008a4e9ee86 Jiri Benc 2015-09-22 141 dst->key.tun_id = src->key.tun_id;
63d008a4e9ee86 Jiri Benc 2015-09-22 142 if (src->mode & IP_TUNNEL_INFO_IPV6)
63d008a4e9ee86 Jiri Benc 2015-09-22 143 memcpy(&dst->key.u.ipv6.dst, &src->key.u.ipv6.src,
63d008a4e9ee86 Jiri Benc 2015-09-22 144 sizeof(struct in6_addr));
63d008a4e9ee86 Jiri Benc 2015-09-22 145 else
63d008a4e9ee86 Jiri Benc 2015-09-22 146 dst->key.u.ipv4.dst = src->key.u.ipv4.src;
d979e3037463d9 Alexander Lobakin 2022-05-04 147 bitmap_copy(dst->key.tun_flags, src->key.tun_flags,
d979e3037463d9 Alexander Lobakin 2022-05-04 148 __IP_TUNNEL_FLAG_NUM);
63d008a4e9ee86 Jiri Benc 2015-09-22 149 dst->mode = src->mode | IP_TUNNEL_INFO_TX;
f52f11ec8ad49f Xin Long 2019-11-06 150 ip_tunnel_info_opts_set(dst, ip_tunnel_info_opts(src),
f52f11ec8ad49f Xin Long 2019-11-06 @151 src->options_len, 0);
63d008a4e9ee86 Jiri Benc 2015-09-22 152
63d008a4e9ee86 Jiri Benc 2015-09-22 153 return res;
63d008a4e9ee86 Jiri Benc 2015-09-22 154 }
63d008a4e9ee86 Jiri Benc 2015-09-22 155 EXPORT_SYMBOL_GPL(iptunnel_metadata_reply);
63d008a4e9ee86 Jiri Benc 2015-09-22 156

:::::: The code at line 151 was first introduced by commit
:::::: f52f11ec8ad49f697e5158ff87c39b44dab45f51 lwtunnel: add options process for arp request

:::::: TO: Xin Long <lucien.xin@xxxxxxxxx>
:::::: CC: David S. Miller <davem@xxxxxxxxxxxxx>

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