net/netfilter/nf_conntrack_proto.c:181:35: sparse: sparse: incorrect type in assignment (different modifiers)
From: kernel test robot
Date: Tue Sep 22 2026 - 11:52:53 EST
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: f0100363d8c374bd8e9ea7c9ba02744f0b802ca4
commit: ac46f3f35b6e68fb062ae7cf780d516c0cf4c00a netfilter: nf_conntrack_helper: add refcounting from datapath
date: 4 months ago
config: um-randconfig-r1307-20260922 (https://download.01.org/0day-ci/archive/20260922/202609222347.fomKeXBU-lkp@xxxxxxxxx/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
sparse: v0.6.5-rc1
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260922/202609222347.fomKeXBU-lkp@xxxxxxxxx/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Fixes: ac46f3f35b6e ("netfilter: nf_conntrack_helper: add refcounting from datapath")
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202609222347.fomKeXBU-lkp@xxxxxxxxx/
sparse warnings: (new ones prefixed by >>)
>> net/netfilter/nf_conntrack_proto.c:181:35: sparse: sparse: incorrect type in assignment (different modifiers) @@ expected int ( *helper_cb )( ... ) @@ got int ( [noderef] * )( ... ) @@
net/netfilter/nf_conntrack_proto.c:181:35: sparse: expected int ( *helper_cb )( ... )
net/netfilter/nf_conntrack_proto.c:181:35: sparse: got int ( [noderef] * )( ... )
vim +181 net/netfilter/nf_conntrack_proto.c
127
128 unsigned int nf_confirm(void *priv,
129 struct sk_buff *skb,
130 const struct nf_hook_state *state)
131 {
132 int (*helper_cb)(struct sk_buff *skb, unsigned int protoff,
133 struct nf_conn *ct,
134 enum ip_conntrack_info conntrackinfo);
135 const struct nf_conn_help *help;
136 enum ip_conntrack_info ctinfo;
137 unsigned int protoff;
138 struct nf_conn *ct;
139 bool seqadj_needed;
140 __be16 frag_off;
141 int start;
142 u8 pnum;
143
144 ct = nf_ct_get(skb, &ctinfo);
145 if (!ct || in_vrf_postrouting(state))
146 return NF_ACCEPT;
147
148 help = nfct_help(ct);
149
150 seqadj_needed = test_bit(IPS_SEQ_ADJUST_BIT, &ct->status) && !nf_is_loopback_packet(skb);
151 if (!help && !seqadj_needed)
152 return nf_conntrack_confirm(skb);
153
154 /* helper->help() do not expect ICMP packets */
155 if (ctinfo == IP_CT_RELATED_REPLY)
156 return nf_conntrack_confirm(skb);
157
158 switch (nf_ct_l3num(ct)) {
159 case NFPROTO_IPV4:
160 protoff = skb_network_offset(skb) + ip_hdrlen(skb);
161 break;
162 case NFPROTO_IPV6:
163 pnum = ipv6_hdr(skb)->nexthdr;
164 start = ipv6_skip_exthdr(skb, sizeof(struct ipv6hdr), &pnum, &frag_off);
165 if (start < 0 || (frag_off & htons(~0x7)) != 0)
166 return nf_conntrack_confirm(skb);
167
168 protoff = start;
169 break;
170 default:
171 return nf_conntrack_confirm(skb);
172 }
173
174 if (help) {
175 const struct nf_conntrack_helper *helper;
176 int ret;
177
178 /* rcu_read_lock()ed by nf_hook */
179 helper = rcu_dereference(help->helper);
180 if (helper) {
> 181 helper_cb = rcu_dereference(helper->help);
182 if (helper_cb) {
183 ret = helper_cb(skb, protoff,
184 ct, ctinfo);
185 if (ret != NF_ACCEPT)
186 return ret;
187 }
188 }
189 }
190
191 if (seqadj_needed &&
192 !nf_ct_seq_adjust(skb, ct, ctinfo, protoff)) {
193 NF_CT_STAT_INC_ATOMIC(nf_ct_net(ct), drop);
194 return NF_DROP;
195 }
196
197 /* We've seen it coming out the other side: confirm it */
198 return nf_conntrack_confirm(skb);
199 }
200 EXPORT_SYMBOL_GPL(nf_confirm);
201
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki