* net/netfilter/nfnetlink_cthelper.c:227:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is true
@ 2026-06-10 23:32 kernel test robot
2026-06-11 0:25 ` Pablo Neira Ayuso
0 siblings, 1 reply; 2+ messages in thread
From: kernel test robot @ 2026-06-10 23:32 UTC (permalink / raw)
To: Pablo Neira Ayuso; +Cc: llvm, oe-kbuild-all, 0day robot
tree: https://github.com/intel-lab-lkp/linux/commits/Pablo-Neira-Ayuso/netfilter-nf_conntrack_helper-dynamically-allocate-struct-nf_conntrack_helper/20260602-061630
head: 739a05785415ce5213468185673fa33bae0e8306
commit: fe02ae4335b9628202025ecd6821fffb1edaed32 netfilter: nf_conntrack_helper: dynamically allocate struct nf_conntrack_helper
date: 9 days ago
config: x86_64-rhel-9.4-rust (https://download.01.org/0day-ci/archive/20260611/202606110148.Pn8XckYm-lkp@intel.com/config)
compiler: clang version 22.0.0git (https://github.com/llvm/llvm-project f43d6834093b19baf79beda8c0337ab020ac5f17)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260611/202606110148.Pn8XckYm-lkp@intel.com/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
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202606110148.Pn8XckYm-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> net/netfilter/nfnetlink_cthelper.c:227:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
227 | if (!helper)
| ^~~~~~~
net/netfilter/nfnetlink_cthelper.c:280:9: note: uninitialized use occurs here
280 | return ret;
| ^~~
net/netfilter/nfnetlink_cthelper.c:227:2: note: remove the 'if' if its condition is always false
227 | if (!helper)
| ^~~~~~~~~~~~
228 | goto err_cth;
| ~~~~~~~~~~~~
net/netfilter/nfnetlink_cthelper.c:217:9: note: initialize the variable 'ret' to silence this warning
217 | int ret;
| ^
| = 0
1 warning generated.
vim +227 net/netfilter/nfnetlink_cthelper.c
209
210 static int
211 nfnl_cthelper_create(const struct nlattr * const tb[],
212 struct nf_conntrack_tuple *tuple)
213 {
214 struct nf_conntrack_helper *helper;
215 struct nfnl_cthelper *nfcth;
216 unsigned int size;
217 int ret;
218
219 if (!tb[NFCTH_TUPLE] || !tb[NFCTH_POLICY] || !tb[NFCTH_PRIV_DATA_LEN])
220 return -EINVAL;
221
222 nfcth = kzalloc_obj(*nfcth, GFP_KERNEL_ACCOUNT);
223 if (nfcth == NULL)
224 return -ENOMEM;
225
226 helper = kzalloc_obj(*helper, GFP_KERNEL_ACCOUNT);
> 227 if (!helper)
228 goto err_cth;
229
230 nfcth->helper = helper;
231
232 ret = nfnl_cthelper_parse_expect_policy(helper, tb[NFCTH_POLICY]);
233 if (ret < 0)
234 goto err_helper;
235
236 nla_strscpy(helper->name,
237 tb[NFCTH_NAME], NF_CT_HELPER_NAME_LEN);
238 size = ntohl(nla_get_be32(tb[NFCTH_PRIV_DATA_LEN]));
239 if (size > sizeof_field(struct nf_conn_help, data)) {
240 ret = -ENOMEM;
241 goto err_helper;
242 }
243 helper->data_len = size;
244
245 helper->flags |= NF_CT_HELPER_F_USERSPACE;
246 memcpy(&helper->tuple, tuple, sizeof(struct nf_conntrack_tuple));
247
248 helper->me = THIS_MODULE;
249 helper->help = nfnl_userspace_cthelper;
250 helper->from_nlattr = nfnl_cthelper_from_nlattr;
251 helper->to_nlattr = nfnl_cthelper_to_nlattr;
252
253 /* Default to queue number zero, this can be updated at any time. */
254 if (tb[NFCTH_QUEUE_NUM])
255 helper->queue_num = ntohl(nla_get_be32(tb[NFCTH_QUEUE_NUM]));
256
257 if (tb[NFCTH_STATUS]) {
258 int status = ntohl(nla_get_be32(tb[NFCTH_STATUS]));
259
260 switch(status) {
261 case NFCT_HELPER_STATUS_ENABLED:
262 helper->flags |= NF_CT_HELPER_F_CONFIGURED;
263 break;
264 case NFCT_HELPER_STATUS_DISABLED:
265 helper->flags &= ~NF_CT_HELPER_F_CONFIGURED;
266 break;
267 }
268 }
269
270 ret = __nf_conntrack_helper_register(helper);
271 if (ret < 0)
272 goto err_helper;
273
274 list_add_tail(&nfcth->list, &nfnl_cthelper_list);
275 return 0;
276 err_helper:
277 kfree(helper);
278 err_cth:
279 kfree(nfcth);
280 return ret;
281 }
282
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: net/netfilter/nfnetlink_cthelper.c:227:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is true
2026-06-10 23:32 net/netfilter/nfnetlink_cthelper.c:227:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is true kernel test robot
@ 2026-06-11 0:25 ` Pablo Neira Ayuso
0 siblings, 0 replies; 2+ messages in thread
From: Pablo Neira Ayuso @ 2026-06-11 0:25 UTC (permalink / raw)
To: kernel test robot; +Cc: llvm, oe-kbuild-all
On Thu, Jun 11, 2026 at 01:32:48AM +0200, kernel test robot wrote:
> vim +227 net/netfilter/nfnetlink_cthelper.c
>
> 209
> 210 static int
> 211 nfnl_cthelper_create(const struct nlattr * const tb[],
> 212 struct nf_conntrack_tuple *tuple)
> 213 {
> 214 struct nf_conntrack_helper *helper;
> 215 struct nfnl_cthelper *nfcth;
> 216 unsigned int size;
> 217 int ret;
> 218
> 219 if (!tb[NFCTH_TUPLE] || !tb[NFCTH_POLICY] || !tb[NFCTH_PRIV_DATA_LEN])
> 220 return -EINVAL;
> 221
> 222 nfcth = kzalloc_obj(*nfcth, GFP_KERNEL_ACCOUNT);
> 223 if (nfcth == NULL)
> 224 return -ENOMEM;
> 225
> 226 helper = kzalloc_obj(*helper, GFP_KERNEL_ACCOUNT);
> > 227 if (!helper)
> 228 goto err_cth;
This seems to be running on an older patch.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-06-11 0:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-10 23:32 net/netfilter/nfnetlink_cthelper.c:227:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is true kernel test robot
2026-06-11 0:25 ` Pablo Neira Ayuso
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.