From: kernel test robot <lkp@intel.com>
To: Florian Westphal <fw@strlen.de>
Cc: llvm@lists.linux.dev, kbuild-all@lists.01.org
Subject: Re: [PATCH v3] netfilter: nf_tables: fix memory leak during stateful obj update
Date: Tue, 22 Feb 2022 01:54:00 +0800 [thread overview]
Message-ID: <202202220115.4cv9qUQN-lkp@intel.com> (raw)
In-Reply-To: <20220221123149.11519-1-fw@strlen.de>
Hi Florian,
I love your patch! Perhaps something to improve:
[auto build test WARNING on nf-next/master]
[also build test WARNING on linus/master v5.17-rc5 next-20220217]
[cannot apply to nf/master]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Florian-Westphal/netfilter-nf_tables-fix-memory-leak-during-stateful-obj-update/20220221-203309
base: https://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf-next.git master
config: i386-randconfig-a012-20220221 (https://download.01.org/0day-ci/archive/20220222/202202220115.4cv9qUQN-lkp@intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project d271fc04d5b97b12e6b797c6067d3c96a8d7470e)
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
# https://github.com/0day-ci/linux/commit/c462078317a686231967b4edac900241eafbbf13
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Florian-Westphal/netfilter-nf_tables-fix-memory-leak-during-stateful-obj-update/20220221-203309
git checkout c462078317a686231967b4edac900241eafbbf13
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash net/netfilter/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
>> net/netfilter/nf_tables_api.c:6561:6: warning: variable 'err' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
if (!trans)
^~~~~~
net/netfilter/nf_tables_api.c:6581:9: note: uninitialized use occurs here
return err;
^~~
net/netfilter/nf_tables_api.c:6561:2: note: remove the 'if' if its condition is always false
if (!trans)
^~~~~~~~~~~
net/netfilter/nf_tables_api.c:6554:9: note: initialize the variable 'err' to silence this warning
int err;
^
= 0
1 warning generated.
vim +6561 net/netfilter/nf_tables_api.c
e50092404c1bc7 Pablo Neira Ayuso 2016-11-28 6546
d62d0ba97b5803 Fernando Fernandez Mancera 2019-08-26 6547 static int nf_tables_updobj(const struct nft_ctx *ctx,
d62d0ba97b5803 Fernando Fernandez Mancera 2019-08-26 6548 const struct nft_object_type *type,
d62d0ba97b5803 Fernando Fernandez Mancera 2019-08-26 6549 const struct nlattr *attr,
d62d0ba97b5803 Fernando Fernandez Mancera 2019-08-26 6550 struct nft_object *obj)
d62d0ba97b5803 Fernando Fernandez Mancera 2019-08-26 6551 {
d62d0ba97b5803 Fernando Fernandez Mancera 2019-08-26 6552 struct nft_object *newobj;
d62d0ba97b5803 Fernando Fernandez Mancera 2019-08-26 6553 struct nft_trans *trans;
d62d0ba97b5803 Fernando Fernandez Mancera 2019-08-26 6554 int err;
d62d0ba97b5803 Fernando Fernandez Mancera 2019-08-26 6555
c462078317a686 Florian Westphal 2022-02-21 6556 if (!try_module_get(type->owner))
c462078317a686 Florian Westphal 2022-02-21 6557 return -ENOENT;
c462078317a686 Florian Westphal 2022-02-21 6558
d62d0ba97b5803 Fernando Fernandez Mancera 2019-08-26 6559 trans = nft_trans_alloc(ctx, NFT_MSG_NEWOBJ,
d62d0ba97b5803 Fernando Fernandez Mancera 2019-08-26 6560 sizeof(struct nft_trans_obj));
d62d0ba97b5803 Fernando Fernandez Mancera 2019-08-26 @6561 if (!trans)
c462078317a686 Florian Westphal 2022-02-21 6562 goto err_trans;
d62d0ba97b5803 Fernando Fernandez Mancera 2019-08-26 6563
d62d0ba97b5803 Fernando Fernandez Mancera 2019-08-26 6564 newobj = nft_obj_init(ctx, type, attr);
d62d0ba97b5803 Fernando Fernandez Mancera 2019-08-26 6565 if (IS_ERR(newobj)) {
d62d0ba97b5803 Fernando Fernandez Mancera 2019-08-26 6566 err = PTR_ERR(newobj);
b74ae9618b15de Dan Carpenter 2019-09-06 6567 goto err_free_trans;
d62d0ba97b5803 Fernando Fernandez Mancera 2019-08-26 6568 }
d62d0ba97b5803 Fernando Fernandez Mancera 2019-08-26 6569
d62d0ba97b5803 Fernando Fernandez Mancera 2019-08-26 6570 nft_trans_obj(trans) = obj;
d62d0ba97b5803 Fernando Fernandez Mancera 2019-08-26 6571 nft_trans_obj_update(trans) = true;
d62d0ba97b5803 Fernando Fernandez Mancera 2019-08-26 6572 nft_trans_obj_newobj(trans) = newobj;
0854db2aaef3fc Florian Westphal 2021-04-01 6573 nft_trans_commit_list_add_tail(ctx->net, trans);
d62d0ba97b5803 Fernando Fernandez Mancera 2019-08-26 6574
d62d0ba97b5803 Fernando Fernandez Mancera 2019-08-26 6575 return 0;
b74ae9618b15de Dan Carpenter 2019-09-06 6576
b74ae9618b15de Dan Carpenter 2019-09-06 6577 err_free_trans:
d62d0ba97b5803 Fernando Fernandez Mancera 2019-08-26 6578 kfree(trans);
c462078317a686 Florian Westphal 2022-02-21 6579 err_trans:
c462078317a686 Florian Westphal 2022-02-21 6580 module_put(type->owner);
d62d0ba97b5803 Fernando Fernandez Mancera 2019-08-26 6581 return err;
d62d0ba97b5803 Fernando Fernandez Mancera 2019-08-26 6582 }
d62d0ba97b5803 Fernando Fernandez Mancera 2019-08-26 6583
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
parent reply other threads:[~2022-02-21 17:54 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <20220221123149.11519-1-fw@strlen.de>]
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=202202220115.4cv9qUQN-lkp@intel.com \
--to=lkp@intel.com \
--cc=fw@strlen.de \
--cc=kbuild-all@lists.01.org \
--cc=llvm@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox