public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [netfilter-nf-next:testing 6/10] net/netfilter/core.c:271:26: warning: unused variable 'hook_bpf_prog'
@ 2022-07-01 15:15 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2022-07-01 15:15 UTC (permalink / raw)
  To: Florian Westphal; +Cc: kbuild-all, linux-kernel

tree:   git://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf-next.git testing
head:   60925d2446cda41b60e41b29c2b4bb2c2b362901
commit: 05ec4cfd58a3b43c47a56f39127dc0c7d1a1ce79 [6/10] netfilter: add bpf base hook program generator
config: i386-randconfig-a005 (https://download.01.org/0day-ci/archive/20220701/202207012311.c24zBDoa-lkp@intel.com/config)
compiler: gcc-11 (Debian 11.3.0-3) 11.3.0
reproduce (this is a W=1 build):
        # https://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf-next.git/commit/?id=05ec4cfd58a3b43c47a56f39127dc0c7d1a1ce79
        git remote add netfilter-nf-next git://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf-next.git
        git fetch --no-tags netfilter-nf-next testing
        git checkout 05ec4cfd58a3b43c47a56f39127dc0c7d1a1ce79
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        make W=1 O=build_dir ARCH=i386 SHELL=/bin/bash net/netfilter/

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

All warnings (new ones prefixed by >>):

   net/netfilter/core.c: In function '__nf_hook_entries_try_shrink':
>> net/netfilter/core.c:271:26: warning: unused variable 'hook_bpf_prog' [-Wunused-variable]
     271 |         struct bpf_prog *hook_bpf_prog = NULL;
         |                          ^~~~~~~~~~~~~


vim +/hook_bpf_prog +271 net/netfilter/core.c

   250	
   251	/*
   252	 * __nf_hook_entries_try_shrink - try to shrink hook array
   253	 *
   254	 * @old -- current hook blob at @pp
   255	 * @pp -- location of hook blob
   256	 *
   257	 * Hook unregistration must always succeed, so to-be-removed hooks
   258	 * are replaced by a dummy one that will just move to next hook.
   259	 *
   260	 * This counts the current dummy hooks, attempts to allocate new blob,
   261	 * copies the live hooks, then replaces and discards old one.
   262	 *
   263	 * return values:
   264	 *
   265	 * Returns address to free, or NULL.
   266	 */
   267	static void *__nf_hook_entries_try_shrink(struct nf_hook_entries *old,
   268						  struct nf_hook_entries __rcu **pp)
   269	{
   270		unsigned int i, j, skip = 0, hook_entries;
 > 271		struct bpf_prog *hook_bpf_prog = NULL;
   272		struct nf_hook_entries *new = NULL;
   273		struct nf_hook_ops **orig_ops;
   274		struct nf_hook_ops **new_ops;
   275	
   276		if (WARN_ON_ONCE(!old))
   277			return NULL;
   278	
   279		orig_ops = nf_hook_entries_get_hook_ops(old);
   280		for (i = 0; i < old->num_hook_entries; i++) {
   281			if (orig_ops[i] == &dummy_ops)
   282				skip++;
   283		}
   284	
   285		/* if skip == hook_entries all hooks have been removed */
   286		hook_entries = old->num_hook_entries;
   287		if (skip == hook_entries)
   288			goto out_assign;
   289	
   290		if (skip == 0)
   291			return NULL;
   292	
   293		hook_entries -= skip;
   294		new = allocate_hook_entries_size(hook_entries);
   295		if (!new) {
   296	#if IS_ENABLED(CONFIG_NF_HOOK_BPF)
   297			struct bpf_prog *old_prog = old->hook_prog;
   298	
   299			WRITE_ONCE(old->hook_prog, fallback_nf_hook_slow);
   300			nf_hook_bpf_change_prog(BPF_DISPATCHER_PTR(nf_hook_base), old_prog, NULL);
   301	#endif
   302			return NULL;
   303		}
   304	
   305		new_ops = nf_hook_entries_get_hook_ops(new);
   306		for (i = 0, j = 0; i < old->num_hook_entries; i++) {
   307			if (orig_ops[i] == &dummy_ops)
   308				continue;
   309			new->hooks[j] = old->hooks[i];
   310			new_ops[j] = (void *)orig_ops[i];
   311			j++;
   312		}
   313		hooks_validate(new);
   314	

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-07-01 15:16 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-01 15:15 [netfilter-nf-next:testing 6/10] net/netfilter/core.c:271:26: warning: unused variable 'hook_bpf_prog' kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox