[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202008100122.Nfg42pqo%lkp@intel.com>
Date: Mon, 10 Aug 2020 01:44:26 +0800
From: kernel test robot <lkp@...el.com>
To: Luc Van Oostenryck <luc.vanoostenryck@...il.com>
Cc: kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org
Subject: net/netfilter/xt_CT.c:99:22: sparse: sparse: incorrect type in
assignment (different address spaces)
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 06a81c1c7db9bd5de0bd38cd5acc44bb22b99150
commit: 670d0a4b10704667765f7d18f7592993d02783aa sparse: use identifiers to define address spaces
date: 7 weeks ago
config: i386-randconfig-s002-20200810 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.2-118-ge1578773-dirty
git checkout 670d0a4b10704667765f7d18f7592993d02783aa
# save the attached .config to linux build tree
make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=i386
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>
sparse warnings: (new ones prefixed by >>)
>> net/netfilter/xt_CT.c:99:22: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected struct nf_conntrack_helper [noderef] __rcu *helper @@ got struct nf_conntrack_helper *[assigned] helper @@
>> net/netfilter/xt_CT.c:99:22: sparse: expected struct nf_conntrack_helper [noderef] __rcu *helper
net/netfilter/xt_CT.c:99:22: sparse: got struct nf_conntrack_helper *[assigned] helper
>> net/netfilter/xt_CT.c:213:45: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct nf_conntrack_helper *helper @@ got struct nf_conntrack_helper [noderef] __rcu *helper @@
net/netfilter/xt_CT.c:213:45: sparse: expected struct nf_conntrack_helper *helper
>> net/netfilter/xt_CT.c:213:45: sparse: got struct nf_conntrack_helper [noderef] __rcu *helper
net/netfilter/xt_CT.c:276:53: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct nf_conntrack_helper *helper @@ got struct nf_conntrack_helper [noderef] __rcu *helper @@
net/netfilter/xt_CT.c:276:53: sparse: expected struct nf_conntrack_helper *helper
net/netfilter/xt_CT.c:276:53: sparse: got struct nf_conntrack_helper [noderef] __rcu *helper
vim +99 net/netfilter/xt_CT.c
84f3bb9ae9db90 Patrick McHardy 2010-02-03 71
236df005614bea Pablo Neira Ayuso 2012-08-28 72 static int
236df005614bea Pablo Neira Ayuso 2012-08-28 73 xt_ct_set_helper(struct nf_conn *ct, const char *helper_name,
236df005614bea Pablo Neira Ayuso 2012-08-28 74 const struct xt_tgchk_param *par)
236df005614bea Pablo Neira Ayuso 2012-08-28 75 {
236df005614bea Pablo Neira Ayuso 2012-08-28 76 struct nf_conntrack_helper *helper;
236df005614bea Pablo Neira Ayuso 2012-08-28 77 struct nf_conn_help *help;
236df005614bea Pablo Neira Ayuso 2012-08-28 78 u8 proto;
236df005614bea Pablo Neira Ayuso 2012-08-28 79
236df005614bea Pablo Neira Ayuso 2012-08-28 80 proto = xt_ct_find_proto(par);
236df005614bea Pablo Neira Ayuso 2012-08-28 81 if (!proto) {
11f7aee2326f37 Florian Westphal 2018-02-09 82 pr_info_ratelimited("You must specify a L4 protocol and not use inversions on it\n");
236df005614bea Pablo Neira Ayuso 2012-08-28 83 return -ENOENT;
236df005614bea Pablo Neira Ayuso 2012-08-28 84 }
236df005614bea Pablo Neira Ayuso 2012-08-28 85
236df005614bea Pablo Neira Ayuso 2012-08-28 86 helper = nf_conntrack_helper_try_module_get(helper_name, par->family,
236df005614bea Pablo Neira Ayuso 2012-08-28 87 proto);
236df005614bea Pablo Neira Ayuso 2012-08-28 88 if (helper == NULL) {
11f7aee2326f37 Florian Westphal 2018-02-09 89 pr_info_ratelimited("No such helper \"%s\"\n", helper_name);
236df005614bea Pablo Neira Ayuso 2012-08-28 90 return -ENOENT;
236df005614bea Pablo Neira Ayuso 2012-08-28 91 }
236df005614bea Pablo Neira Ayuso 2012-08-28 92
440534d3c56be0 Gao Feng 2018-07-09 93 help = nf_ct_helper_ext_add(ct, GFP_KERNEL);
236df005614bea Pablo Neira Ayuso 2012-08-28 94 if (help == NULL) {
d91fc59cd77c71 Liping Zhang 2017-05-07 95 nf_conntrack_helper_put(helper);
236df005614bea Pablo Neira Ayuso 2012-08-28 96 return -ENOMEM;
236df005614bea Pablo Neira Ayuso 2012-08-28 97 }
236df005614bea Pablo Neira Ayuso 2012-08-28 98
236df005614bea Pablo Neira Ayuso 2012-08-28 @99 help->helper = helper;
236df005614bea Pablo Neira Ayuso 2012-08-28 100 return 0;
236df005614bea Pablo Neira Ayuso 2012-08-28 101 }
236df005614bea Pablo Neira Ayuso 2012-08-28 102
236df005614bea Pablo Neira Ayuso 2012-08-28 103 static int
236df005614bea Pablo Neira Ayuso 2012-08-28 104 xt_ct_set_timeout(struct nf_conn *ct, const struct xt_tgchk_param *par,
236df005614bea Pablo Neira Ayuso 2012-08-28 105 const char *timeout_name)
236df005614bea Pablo Neira Ayuso 2012-08-28 106 {
236df005614bea Pablo Neira Ayuso 2012-08-28 107 #ifdef CONFIG_NF_CONNTRACK_TIMEOUT
b3480fe059ac91 Florian Westphal 2017-08-12 108 const struct nf_conntrack_l4proto *l4proto;
0153d5a810ab33 Pablo Neira Ayuso 2012-10-11 109 u8 proto;
236df005614bea Pablo Neira Ayuso 2012-08-28 110
0153d5a810ab33 Pablo Neira Ayuso 2012-10-11 111 proto = xt_ct_find_proto(par);
0153d5a810ab33 Pablo Neira Ayuso 2012-10-11 112 if (!proto) {
717700d183d65b Yi-Hung Wei 2019-03-26 113 pr_info_ratelimited("You must specify a L4 protocol and not "
717700d183d65b Yi-Hung Wei 2019-03-26 114 "use inversions on it");
717700d183d65b Yi-Hung Wei 2019-03-26 115 return -EINVAL;
236df005614bea Pablo Neira Ayuso 2012-08-28 116 }
4a60dc748d121b Florian Westphal 2019-01-15 117 l4proto = nf_ct_l4proto_find(proto);
717700d183d65b Yi-Hung Wei 2019-03-26 118 return nf_ct_set_timeout(par->net, ct, par->family, l4proto->l4proto,
717700d183d65b Yi-Hung Wei 2019-03-26 119 timeout_name);
403d89ad9cc076 Pablo Neira Ayuso 2015-10-05 120
236df005614bea Pablo Neira Ayuso 2012-08-28 121 #else
236df005614bea Pablo Neira Ayuso 2012-08-28 122 return -EOPNOTSUPP;
236df005614bea Pablo Neira Ayuso 2012-08-28 123 #endif
236df005614bea Pablo Neira Ayuso 2012-08-28 124 }
236df005614bea Pablo Neira Ayuso 2012-08-28 125
deedb59039f111 Daniel Borkmann 2015-08-14 126 static u16 xt_ct_flags_to_dir(const struct xt_ct_target_info_v1 *info)
deedb59039f111 Daniel Borkmann 2015-08-14 127 {
deedb59039f111 Daniel Borkmann 2015-08-14 128 switch (info->flags & (XT_CT_ZONE_DIR_ORIG |
deedb59039f111 Daniel Borkmann 2015-08-14 129 XT_CT_ZONE_DIR_REPL)) {
deedb59039f111 Daniel Borkmann 2015-08-14 130 case XT_CT_ZONE_DIR_ORIG:
deedb59039f111 Daniel Borkmann 2015-08-14 131 return NF_CT_ZONE_DIR_ORIG;
deedb59039f111 Daniel Borkmann 2015-08-14 132 case XT_CT_ZONE_DIR_REPL:
deedb59039f111 Daniel Borkmann 2015-08-14 133 return NF_CT_ZONE_DIR_REPL;
deedb59039f111 Daniel Borkmann 2015-08-14 134 default:
deedb59039f111 Daniel Borkmann 2015-08-14 135 return NF_CT_DEFAULT_ZONE_DIR;
deedb59039f111 Daniel Borkmann 2015-08-14 136 }
deedb59039f111 Daniel Borkmann 2015-08-14 137 }
deedb59039f111 Daniel Borkmann 2015-08-14 138
d52ed4379a8264 Pablo Neira Ayuso 2013-01-30 139 static int xt_ct_tg_check(const struct xt_tgchk_param *par,
d52ed4379a8264 Pablo Neira Ayuso 2013-01-30 140 struct xt_ct_target_info_v1 *info)
24de58f4651652 Pablo Neira Ayuso 2012-02-29 141 {
308ac9143ee220 Daniel Borkmann 2015-08-08 142 struct nf_conntrack_zone zone;
470acf55a02171 Gao Feng 2017-04-14 143 struct nf_conn_help *help;
24de58f4651652 Pablo Neira Ayuso 2012-02-29 144 struct nf_conn *ct;
4610476d89d537 Pablo Neira Ayuso 2013-01-10 145 int ret = -EOPNOTSUPP;
236df005614bea Pablo Neira Ayuso 2012-08-28 146
24de58f4651652 Pablo Neira Ayuso 2012-02-29 147 if (info->flags & XT_CT_NOTRACK) {
27e7190efd5b2f Eric Dumazet 2013-05-22 148 ct = NULL;
24de58f4651652 Pablo Neira Ayuso 2012-02-29 149 goto out;
24de58f4651652 Pablo Neira Ayuso 2012-02-29 150 }
24de58f4651652 Pablo Neira Ayuso 2012-02-29 151
24de58f4651652 Pablo Neira Ayuso 2012-02-29 152 #ifndef CONFIG_NF_CONNTRACK_ZONES
deedb59039f111 Daniel Borkmann 2015-08-14 153 if (info->zone || info->flags & (XT_CT_ZONE_DIR_ORIG |
5e8018fc61423e Daniel Borkmann 2015-08-14 154 XT_CT_ZONE_DIR_REPL |
5e8018fc61423e Daniel Borkmann 2015-08-14 155 XT_CT_ZONE_MARK))
24de58f4651652 Pablo Neira Ayuso 2012-02-29 156 goto err1;
24de58f4651652 Pablo Neira Ayuso 2012-02-29 157 #endif
24de58f4651652 Pablo Neira Ayuso 2012-02-29 158
ecb2421b5ddf48 Florian Westphal 2016-11-15 159 ret = nf_ct_netns_get(par->net, par->family);
24de58f4651652 Pablo Neira Ayuso 2012-02-29 160 if (ret < 0)
24de58f4651652 Pablo Neira Ayuso 2012-02-29 161 goto err1;
24de58f4651652 Pablo Neira Ayuso 2012-02-29 162
308ac9143ee220 Daniel Borkmann 2015-08-08 163 memset(&zone, 0, sizeof(zone));
308ac9143ee220 Daniel Borkmann 2015-08-08 164 zone.id = info->zone;
deedb59039f111 Daniel Borkmann 2015-08-14 165 zone.dir = xt_ct_flags_to_dir(info);
5e8018fc61423e Daniel Borkmann 2015-08-14 166 if (info->flags & XT_CT_ZONE_MARK)
5e8018fc61423e Daniel Borkmann 2015-08-14 167 zone.flags |= NF_CT_FLAG_MARK;
308ac9143ee220 Daniel Borkmann 2015-08-08 168
308ac9143ee220 Daniel Borkmann 2015-08-08 169 ct = nf_ct_tmpl_alloc(par->net, &zone, GFP_KERNEL);
1a727c63612fc5 Dan Carpenter 2015-07-28 170 if (!ct) {
1a727c63612fc5 Dan Carpenter 2015-07-28 171 ret = -ENOMEM;
24de58f4651652 Pablo Neira Ayuso 2012-02-29 172 goto err2;
1a727c63612fc5 Dan Carpenter 2015-07-28 173 }
24de58f4651652 Pablo Neira Ayuso 2012-02-29 174
24de58f4651652 Pablo Neira Ayuso 2012-02-29 175 ret = 0;
24de58f4651652 Pablo Neira Ayuso 2012-02-29 176 if ((info->ct_events || info->exp_events) &&
24de58f4651652 Pablo Neira Ayuso 2012-02-29 177 !nf_ct_ecache_ext_add(ct, info->ct_events, info->exp_events,
14abfa161d256c Eric Leblond 2014-01-02 178 GFP_KERNEL)) {
14abfa161d256c Eric Leblond 2014-01-02 179 ret = -EINVAL;
24de58f4651652 Pablo Neira Ayuso 2012-02-29 180 goto err3;
14abfa161d256c Eric Leblond 2014-01-02 181 }
24de58f4651652 Pablo Neira Ayuso 2012-02-29 182
24de58f4651652 Pablo Neira Ayuso 2012-02-29 183 if (info->helper[0]) {
8f4d19aacb64f2 Gao Feng 2018-05-30 184 if (strnlen(info->helper, sizeof(info->helper)) == sizeof(info->helper)) {
8f4d19aacb64f2 Gao Feng 2018-05-30 185 ret = -ENAMETOOLONG;
8f4d19aacb64f2 Gao Feng 2018-05-30 186 goto err3;
8f4d19aacb64f2 Gao Feng 2018-05-30 187 }
8f4d19aacb64f2 Gao Feng 2018-05-30 188
236df005614bea Pablo Neira Ayuso 2012-08-28 189 ret = xt_ct_set_helper(ct, info->helper, par);
236df005614bea Pablo Neira Ayuso 2012-08-28 190 if (ret < 0)
24de58f4651652 Pablo Neira Ayuso 2012-02-29 191 goto err3;
24de58f4651652 Pablo Neira Ayuso 2012-02-29 192 }
1afc56794e0322 Pablo Neira Ayuso 2012-06-07 193
6cf51852486af3 Pablo Neira Ayuso 2012-04-27 194 if (info->timeout[0]) {
8f4d19aacb64f2 Gao Feng 2018-05-30 195 if (strnlen(info->timeout, sizeof(info->timeout)) == sizeof(info->timeout)) {
8f4d19aacb64f2 Gao Feng 2018-05-30 196 ret = -ENAMETOOLONG;
8f4d19aacb64f2 Gao Feng 2018-05-30 197 goto err4;
8f4d19aacb64f2 Gao Feng 2018-05-30 198 }
8f4d19aacb64f2 Gao Feng 2018-05-30 199
236df005614bea Pablo Neira Ayuso 2012-08-28 200 ret = xt_ct_set_timeout(ct, par, info->timeout);
236df005614bea Pablo Neira Ayuso 2012-08-28 201 if (ret < 0)
470acf55a02171 Gao Feng 2017-04-14 202 goto err4;
24de58f4651652 Pablo Neira Ayuso 2012-02-29 203 }
0838aa7fcfcd87 Pablo Neira Ayuso 2015-07-13 204 __set_bit(IPS_CONFIRMED_BIT, &ct->status);
0838aa7fcfcd87 Pablo Neira Ayuso 2015-07-13 205 nf_conntrack_get(&ct->ct_general);
24de58f4651652 Pablo Neira Ayuso 2012-02-29 206 out:
24de58f4651652 Pablo Neira Ayuso 2012-02-29 207 info->ct = ct;
24de58f4651652 Pablo Neira Ayuso 2012-02-29 208 return 0;
24de58f4651652 Pablo Neira Ayuso 2012-02-29 209
470acf55a02171 Gao Feng 2017-04-14 210 err4:
470acf55a02171 Gao Feng 2017-04-14 211 help = nfct_help(ct);
470acf55a02171 Gao Feng 2017-04-14 212 if (help)
d91fc59cd77c71 Liping Zhang 2017-05-07 @213 nf_conntrack_helper_put(help->helper);
24de58f4651652 Pablo Neira Ayuso 2012-02-29 214 err3:
9cf94eab8b309e Daniel Borkmann 2015-08-31 215 nf_ct_tmpl_free(ct);
24de58f4651652 Pablo Neira Ayuso 2012-02-29 216 err2:
ecb2421b5ddf48 Florian Westphal 2016-11-15 217 nf_ct_netns_put(par->net, par->family);
24de58f4651652 Pablo Neira Ayuso 2012-02-29 218 err1:
24de58f4651652 Pablo Neira Ayuso 2012-02-29 219 return ret;
24de58f4651652 Pablo Neira Ayuso 2012-02-29 220 }
24de58f4651652 Pablo Neira Ayuso 2012-02-29 221
:::::: The code at line 99 was first introduced by commit
:::::: 236df005614bea6a2f9afa9867e3bdfc206c6291 netfilter: xt_CT: refactorize xt_ct_tg_check
:::::: TO: Pablo Neira Ayuso <pablo@...filter.org>
:::::: CC: Pablo Neira Ayuso <pablo@...filter.org>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Download attachment ".config.gz" of type "application/gzip" (35386 bytes)
Powered by blists - more mailing lists