All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: oe-kbuild@lists.linux.dev
Cc: lkp@intel.com, Dan Carpenter <error27@gmail.com>
Subject: Re: [nf PATCH v2] netfilter: nf_tables: Fix entries val in rule reset audit log
Date: Sat, 23 Sep 2023 06:23:12 +0800	[thread overview]
Message-ID: <202309230628.jYkaSoee-lkp@intel.com> (raw)

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
In-Reply-To: <20230908081033.30806-1-phil@nwl.cc>
References: <20230908081033.30806-1-phil@nwl.cc>
TO: Phil Sutter <phil@nwl.cc>

Hi Phil,

kernel test robot noticed the following build warnings:

[auto build test WARNING on netfilter-nf/main]

url:    https://github.com/intel-lab-lkp/linux/commits/Phil-Sutter/netfilter-nf_tables-Fix-entries-val-in-rule-reset-audit-log/20230908-161249
base:   git://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf.git main
patch link:    https://lore.kernel.org/r/20230908081033.30806-1-phil%40nwl.cc
patch subject: [nf PATCH v2] netfilter: nf_tables: Fix entries val in rule reset audit log
:::::: branch date: 2 weeks ago
:::::: commit date: 2 weeks ago
config: i386-randconfig-141-20230922 (https://download.01.org/0day-ci/archive/20230923/202309230628.jYkaSoee-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce: (https://download.01.org/0day-ci/archive/20230923/202309230628.jYkaSoee-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>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202309230628.jYkaSoee-lkp@intel.com/

smatch warnings:
net/netfilter/nf_tables_api.c:3546 nf_tables_dump_rules() error: uninitialized symbol 'ret'.

vim +/ret +3546 net/netfilter/nf_tables_api.c

241faeceb849cb Phil Sutter       2018-12-12  3486  
96518518cc417b Patrick McHardy   2013-10-14  3487  static int nf_tables_dump_rules(struct sk_buff *skb,
96518518cc417b Patrick McHardy   2013-10-14  3488  				struct netlink_callback *cb)
96518518cc417b Patrick McHardy   2013-10-14  3489  {
96518518cc417b Patrick McHardy   2013-10-14  3490  	const struct nfgenmsg *nfmsg = nlmsg_data(cb->nlh);
6e1f760e13c75e Pablo Neira Ayuso 2016-07-19  3491  	const struct nft_rule_dump_ctx *ctx = cb->data;
241faeceb849cb Phil Sutter       2018-12-12  3492  	struct nft_table *table;
96518518cc417b Patrick McHardy   2013-10-14  3493  	const struct nft_chain *chain;
35118755b61ff5 Phil Sutter       2023-09-08  3494  	unsigned int idx = 0, s_idx;
99633ab29b2131 Pablo Neira Ayuso 2013-10-10  3495  	struct net *net = sock_net(skb->sk);
96518518cc417b Patrick McHardy   2013-10-14  3496  	int family = nfmsg->nfgen_family;
0854db2aaef3fc Florian Westphal  2021-04-01  3497  	struct nftables_pernet *nft_net;
8daa8fde3fc3f0 Phil Sutter       2022-10-14  3498  	bool reset = false;
35118755b61ff5 Phil Sutter       2023-09-08  3499  	int ret;
8daa8fde3fc3f0 Phil Sutter       2022-10-14  3500  
8daa8fde3fc3f0 Phil Sutter       2022-10-14  3501  	if (NFNL_MSG_TYPE(cb->nlh->nlmsg_type) == NFT_MSG_GETRULE_RESET)
8daa8fde3fc3f0 Phil Sutter       2022-10-14  3502  		reset = true;
96518518cc417b Patrick McHardy   2013-10-14  3503  
e688a7f8c6cb7a Pablo Neira Ayuso 2014-07-01  3504  	rcu_read_lock();
d59d2f82f984df Pablo Neira Ayuso 2021-04-23  3505  	nft_net = nft_pernet(net);
3400278328285a Pablo Neira Ayuso 2022-08-09  3506  	cb->seq = READ_ONCE(nft_net->base_seq);
38e029f14a9702 Pablo Neira Ayuso 2014-07-01  3507  
0854db2aaef3fc Florian Westphal  2021-04-01  3508  	list_for_each_entry_rcu(table, &nft_net->tables, list) {
98319cb9089844 Pablo Neira Ayuso 2018-01-09  3509  		if (family != NFPROTO_UNSPEC && family != table->family)
96518518cc417b Patrick McHardy   2013-10-14  3510  			continue;
96518518cc417b Patrick McHardy   2013-10-14  3511  
36596dadf54a92 Pablo Neira Ayuso 2018-01-09  3512  		if (ctx && ctx->table && strcmp(ctx->table, table->name) != 0)
6e1f760e13c75e Pablo Neira Ayuso 2016-07-19  3513  			continue;
6e1f760e13c75e Pablo Neira Ayuso 2016-07-19  3514  
715849ab31f8e5 Pablo Neira Ayuso 2019-01-08  3515  		if (ctx && ctx->table && ctx->chain) {
241faeceb849cb Phil Sutter       2018-12-12  3516  			struct rhlist_head *list, *tmp;
6e1f760e13c75e Pablo Neira Ayuso 2016-07-19  3517  
241faeceb849cb Phil Sutter       2018-12-12  3518  			list = rhltable_lookup(&table->chains_ht, ctx->chain,
241faeceb849cb Phil Sutter       2018-12-12  3519  					       nft_chain_ht_params);
241faeceb849cb Phil Sutter       2018-12-12  3520  			if (!list)
96518518cc417b Patrick McHardy   2013-10-14  3521  				goto done;
38e029f14a9702 Pablo Neira Ayuso 2014-07-01  3522  
241faeceb849cb Phil Sutter       2018-12-12  3523  			rhl_for_each_entry_rcu(chain, tmp, list, rhlhead) {
241faeceb849cb Phil Sutter       2018-12-12  3524  				if (!nft_is_active(net, chain))
241faeceb849cb Phil Sutter       2018-12-12  3525  					continue;
241faeceb849cb Phil Sutter       2018-12-12  3526  				__nf_tables_dump_rules(skb, &idx,
8daa8fde3fc3f0 Phil Sutter       2022-10-14  3527  						       cb, table, chain, reset);
241faeceb849cb Phil Sutter       2018-12-12  3528  				break;
96518518cc417b Patrick McHardy   2013-10-14  3529  			}
35118755b61ff5 Phil Sutter       2023-09-08  3530  			if (reset && idx > cb->args[0])
35118755b61ff5 Phil Sutter       2023-09-08  3531  				audit_log_rule_reset(table, cb->seq,
35118755b61ff5 Phil Sutter       2023-09-08  3532  						     idx - cb->args[0]);
241faeceb849cb Phil Sutter       2018-12-12  3533  			goto done;
96518518cc417b Patrick McHardy   2013-10-14  3534  		}
241faeceb849cb Phil Sutter       2018-12-12  3535  
35118755b61ff5 Phil Sutter       2023-09-08  3536  		s_idx = max_t(long, idx, cb->args[0]);
241faeceb849cb Phil Sutter       2018-12-12  3537  		list_for_each_entry_rcu(chain, &table->chains, list) {
35118755b61ff5 Phil Sutter       2023-09-08  3538  			ret = __nf_tables_dump_rules(skb, &idx,
35118755b61ff5 Phil Sutter       2023-09-08  3539  						     cb, table, chain, reset);
35118755b61ff5 Phil Sutter       2023-09-08  3540  			if (ret)
35118755b61ff5 Phil Sutter       2023-09-08  3541  				break;
241faeceb849cb Phil Sutter       2018-12-12  3542  		}
35118755b61ff5 Phil Sutter       2023-09-08  3543  		if (reset && idx > s_idx)
35118755b61ff5 Phil Sutter       2023-09-08  3544  			audit_log_rule_reset(table, cb->seq, idx - s_idx);
241faeceb849cb Phil Sutter       2018-12-12  3545  
35118755b61ff5 Phil Sutter       2023-09-08 @3546  		if ((ctx && ctx->table) || ret)
241faeceb849cb Phil Sutter       2018-12-12  3547  			break;
96518518cc417b Patrick McHardy   2013-10-14  3548  	}
96518518cc417b Patrick McHardy   2013-10-14  3549  done:
e688a7f8c6cb7a Pablo Neira Ayuso 2014-07-01  3550  	rcu_read_unlock();
310529e663ed97 Phil Sutter       2018-12-30  3551  
310529e663ed97 Phil Sutter       2018-12-30  3552  	cb->args[0] = idx;
96518518cc417b Patrick McHardy   2013-10-14  3553  	return skb->len;
96518518cc417b Patrick McHardy   2013-10-14  3554  }
96518518cc417b Patrick McHardy   2013-10-14  3555  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

             reply	other threads:[~2023-09-22 22:24 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-22 22:23 kernel test robot [this message]
  -- strict thread matches above, loose matches on Subject: below --
2023-09-08  8:10 [nf PATCH v2] netfilter: nf_tables: Fix entries val in rule reset audit log Phil Sutter
2023-09-08 14:01 ` Pablo Neira Ayuso
2023-09-08 14:42   ` Phil Sutter
2023-09-08 14:59     ` Pablo Neira Ayuso

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202309230628.jYkaSoee-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=error27@gmail.com \
    --cc=oe-kbuild@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.