Hi Florian,
I love your patch! Perhaps something to improve:
[auto build test WARNING on nf-next/master]
url:
https://github.com/0day-ci/linux/commits/Florian-Westphal/netfilter-add-h...
base:
https://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf-next.git master
config: x86_64-randconfig-r026-20210522 (attached as .config)
compiler: clang version 13.0.0 (
https://github.com/llvm/llvm-project
e84a9b9bb3051c35dea993cdad7b3d2575638f85)
reproduce (this is a W=1 build):
wget
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O
~/bin/make.cross
chmod +x ~/bin/make.cross
# install x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
#
https://github.com/0day-ci/linux/commit/0d9a4c5b44ef1ad2d9ed5c4c8cea7eae2...
git remote add linux-review
https://github.com/0day-ci/linux
git fetch --no-tags linux-review
Florian-Westphal/netfilter-add-hook-dump-feature/20210522-225655
git checkout 0d9a4c5b44ef1ad2d9ed5c4c8cea7eae29560706
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All warnings (new ones prefixed by >>):
> net/netfilter/nf_tables_api.c:7991:6: warning: variable
'ret' is used uninitialized whenever 'if' condition is true
[-Wsometimes-uninitialized]
if (!nlh)
^~~~
net/netfilter/nf_tables_api.c:8006:9: note: uninitialized use occurs here
return ret;
^~~
net/netfilter/nf_tables_api.c:7991:2: note: remove the 'if' if its condition is
always false
if (!nlh)
^~~~~~~~~
net/netfilter/nf_tables_api.c:7987:9: note: initialize the variable 'ret' to
silence this warning
int ret;
^
= 0
1 warning generated.
vim +7991 net/netfilter/nf_tables_api.c
7979
7980 static int nf_tables_dump_one_hook(struct sk_buff *nlskb,
7981 const struct nft_dump_hooks_data *ctx,
7982 const struct nf_hook_ops *ops)
7983 {
7984 unsigned int portid = NETLINK_CB(nlskb).portid;
7985 struct net *net = sock_net(nlskb->sk);
7986 struct nlmsghdr *nlh;
7987 int ret;
7988
7989 nlh = nfnl_msg_put(nlskb, portid, ctx->seq, NFT_MSG_GETNFHOOKS,
7990 NLM_F_MULTI, ops->pf, NFNETLINK_V0, nft_base_seq(net));
7991 if (!nlh)
7992 goto nla_put_failure;
7993
7994 ret = nla_put_be32(nlskb, NFTA_HOOK_HOOKNUM, htonl(ops->hooknum));
7995 if (ret)
7996 goto nla_put_failure;
7997
7998 ret = nla_put_be32(nlskb, NFTA_HOOK_PRIORITY, htonl(ops->priority));
7999 if (ret)
8000 goto nla_put_failure;
8001
8002 nlmsg_end(nlskb, nlh);
8003 return 0;
8004 nla_put_failure:
8005 nlmsg_trim(nlskb, nlh);
8006 return ret;
8007 }
8008
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org