All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <yujie.liu@intel.com>
To: Alexei Starovoitov <ast@kernel.org>
Cc: <llvm@lists.linux.dev>, <kbuild-all@lists.01.org>,
	"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>
Subject: [ast-bpf:relo_core 5/11] kernel/bpf/btf.c:6524:2: warning: Value stored to 'err' is never read [clang-analyzer-deadcode.DeadStores]
Date: Mon, 20 Sep 2021 11:45:32 +0800	[thread overview]
Message-ID: <85ad33a4-2255-63dc-abab-36d62df6ae35@intel.com> (raw)
In-Reply-To: <202109191754.t1cndP9Q-lkp@intel.com>

[-- Attachment #1: Type: text/plain, Size: 4796 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/ast/bpf.git relo_core
head:   35a0182c26565e1db43f99a764834bff8a2e4202
commit: 98beca424883749fbcf9f244bb26c96ed3102502 [5/11] bpf: Add bpf_core_add_cands() and wire it into bpf_core_apply_relo_insn().
:::::: branch date: 2 days ago
:::::: commit date: 2 days ago
config: riscv-randconfig-c006-20210919 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project c8b3d7d6d6de37af68b2f379d0e37304f78e115f)
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 riscv cross compiling tool for clang build
         # apt-get install binutils-riscv64-linux-gnu
         # https://git.kernel.org/pub/scm/linux/kernel/git/ast/bpf.git/commit/?id=98beca424883749fbcf9f244bb26c96ed3102502
         git remote add ast-bpf https://git.kernel.org/pub/scm/linux/kernel/git/ast/bpf.git
         git fetch --no-tags ast-bpf relo_core
         git checkout 98beca424883749fbcf9f244bb26c96ed3102502
         # save the attached .config to linux build tree
         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=riscv clang-analyzer

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


clang-analyzer warnings: (new ones prefixed by >>)

 >> kernel/bpf/btf.c:6524:2: warning: Value stored to 'err' is never read [clang-analyzer-deadcode.DeadStores]
            err = bpf_core_apply_relo_insn("prog_name", insn, 0, &core_relo, 0, btf, cands);
            ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

vim +/err +6524 kernel/bpf/btf.c

98beca42488374 Alexei Starovoitov 2021-09-16  6491
fab12a1832b619 Alexei Starovoitov 2021-09-08  6492  BPF_CALL_5(bpf_core_apply_relo, int, btf_fd, struct bpf_core_relo_desc *, relo,
fab12a1832b619 Alexei Starovoitov 2021-09-08  6493  	   int, relo_sz, void *, insn, int, flags)
fab12a1832b619 Alexei Starovoitov 2021-09-08  6494  {
98beca42488374 Alexei Starovoitov 2021-09-16  6495  	struct bpf_core_cand_list *cands = NULL;
98beca42488374 Alexei Starovoitov 2021-09-16  6496  	struct bpf_core_relo core_relo = {};
fab12a1832b619 Alexei Starovoitov 2021-09-08  6497  	struct btf *btf;
98beca42488374 Alexei Starovoitov 2021-09-16  6498  	int err;
fab12a1832b619 Alexei Starovoitov 2021-09-08  6499
fab12a1832b619 Alexei Starovoitov 2021-09-08  6500  	if (flags)
fab12a1832b619 Alexei Starovoitov 2021-09-08  6501  		return -EINVAL;
98beca42488374 Alexei Starovoitov 2021-09-16  6502
98beca42488374 Alexei Starovoitov 2021-09-16  6503  	if (sizeof(*relo) != relo_sz)
98beca42488374 Alexei Starovoitov 2021-09-16  6504  		return -EINVAL;
98beca42488374 Alexei Starovoitov 2021-09-16  6505  	btf = btf_get_by_fd(btf_fd);
98beca42488374 Alexei Starovoitov 2021-09-16  6506  	if (IS_ERR(btf))
98beca42488374 Alexei Starovoitov 2021-09-16  6507  		return PTR_ERR(btf);
98beca42488374 Alexei Starovoitov 2021-09-16  6508  	if (btf_is_kernel(btf)) {
98beca42488374 Alexei Starovoitov 2021-09-16  6509  		btf_put(btf);
98beca42488374 Alexei Starovoitov 2021-09-16  6510  		return -EACCES;
98beca42488374 Alexei Starovoitov 2021-09-16  6511  	}
98beca42488374 Alexei Starovoitov 2021-09-16  6512  	if (relo->kind != BPF_CORE_TYPE_ID_LOCAL) {
98beca42488374 Alexei Starovoitov 2021-09-16  6513  		cands = bpf_core_find_cands(btf, relo->type_id);
98beca42488374 Alexei Starovoitov 2021-09-16  6514  		if (IS_ERR(cands)) {
98beca42488374 Alexei Starovoitov 2021-09-16  6515  			btf_put(btf);
98beca42488374 Alexei Starovoitov 2021-09-16  6516  			printk("target candidate search failed for %d\n",
98beca42488374 Alexei Starovoitov 2021-09-16  6517  			       relo->type_id);
98beca42488374 Alexei Starovoitov 2021-09-16  6518                          return PTR_ERR(cands);
98beca42488374 Alexei Starovoitov 2021-09-16  6519                  }
98beca42488374 Alexei Starovoitov 2021-09-16  6520  	}
98beca42488374 Alexei Starovoitov 2021-09-16  6521  	core_relo.type_id = relo->type_id;
98beca42488374 Alexei Starovoitov 2021-09-16  6522  	core_relo.access_str_off = relo->access_str_off;
98beca42488374 Alexei Starovoitov 2021-09-16  6523  	core_relo.kind = relo->kind;
98beca42488374 Alexei Starovoitov 2021-09-16 @6524  	err = bpf_core_apply_relo_insn("prog_name", insn, 0, &core_relo, 0, btf, cands);
98beca42488374 Alexei Starovoitov 2021-09-16  6525  	btf_put(btf);
98beca42488374 Alexei Starovoitov 2021-09-16  6526  	return 0;
fab12a1832b619 Alexei Starovoitov 2021-09-08  6527  }
fab12a1832b619 Alexei Starovoitov 2021-09-08  6528

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 30149 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: kernel test robot <yujie.liu@intel.com>
To: kbuild-all@lists.01.org
Subject: [ast-bpf:relo_core 5/11] kernel/bpf/btf.c:6524:2: warning: Value stored to 'err' is never read [clang-analyzer-deadcode.DeadStores]
Date: Mon, 20 Sep 2021 11:45:32 +0800	[thread overview]
Message-ID: <85ad33a4-2255-63dc-abab-36d62df6ae35@intel.com> (raw)
In-Reply-To: <202109191754.t1cndP9Q-lkp@intel.com>

[-- Attachment #1: Type: text/plain, Size: 4872 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/ast/bpf.git relo_core
head:   35a0182c26565e1db43f99a764834bff8a2e4202
commit: 98beca424883749fbcf9f244bb26c96ed3102502 [5/11] bpf: Add bpf_core_add_cands() and wire it into bpf_core_apply_relo_insn().
:::::: branch date: 2 days ago
:::::: commit date: 2 days ago
config: riscv-randconfig-c006-20210919 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project c8b3d7d6d6de37af68b2f379d0e37304f78e115f)
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 riscv cross compiling tool for clang build
         # apt-get install binutils-riscv64-linux-gnu
         # https://git.kernel.org/pub/scm/linux/kernel/git/ast/bpf.git/commit/?id=98beca424883749fbcf9f244bb26c96ed3102502
         git remote add ast-bpf https://git.kernel.org/pub/scm/linux/kernel/git/ast/bpf.git
         git fetch --no-tags ast-bpf relo_core
         git checkout 98beca424883749fbcf9f244bb26c96ed3102502
         # save the attached .config to linux build tree
         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=riscv clang-analyzer

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


clang-analyzer warnings: (new ones prefixed by >>)

 >> kernel/bpf/btf.c:6524:2: warning: Value stored to 'err' is never read [clang-analyzer-deadcode.DeadStores]
            err = bpf_core_apply_relo_insn("prog_name", insn, 0, &core_relo, 0, btf, cands);
            ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

vim +/err +6524 kernel/bpf/btf.c

98beca42488374 Alexei Starovoitov 2021-09-16  6491
fab12a1832b619 Alexei Starovoitov 2021-09-08  6492  BPF_CALL_5(bpf_core_apply_relo, int, btf_fd, struct bpf_core_relo_desc *, relo,
fab12a1832b619 Alexei Starovoitov 2021-09-08  6493  	   int, relo_sz, void *, insn, int, flags)
fab12a1832b619 Alexei Starovoitov 2021-09-08  6494  {
98beca42488374 Alexei Starovoitov 2021-09-16  6495  	struct bpf_core_cand_list *cands = NULL;
98beca42488374 Alexei Starovoitov 2021-09-16  6496  	struct bpf_core_relo core_relo = {};
fab12a1832b619 Alexei Starovoitov 2021-09-08  6497  	struct btf *btf;
98beca42488374 Alexei Starovoitov 2021-09-16  6498  	int err;
fab12a1832b619 Alexei Starovoitov 2021-09-08  6499
fab12a1832b619 Alexei Starovoitov 2021-09-08  6500  	if (flags)
fab12a1832b619 Alexei Starovoitov 2021-09-08  6501  		return -EINVAL;
98beca42488374 Alexei Starovoitov 2021-09-16  6502
98beca42488374 Alexei Starovoitov 2021-09-16  6503  	if (sizeof(*relo) != relo_sz)
98beca42488374 Alexei Starovoitov 2021-09-16  6504  		return -EINVAL;
98beca42488374 Alexei Starovoitov 2021-09-16  6505  	btf = btf_get_by_fd(btf_fd);
98beca42488374 Alexei Starovoitov 2021-09-16  6506  	if (IS_ERR(btf))
98beca42488374 Alexei Starovoitov 2021-09-16  6507  		return PTR_ERR(btf);
98beca42488374 Alexei Starovoitov 2021-09-16  6508  	if (btf_is_kernel(btf)) {
98beca42488374 Alexei Starovoitov 2021-09-16  6509  		btf_put(btf);
98beca42488374 Alexei Starovoitov 2021-09-16  6510  		return -EACCES;
98beca42488374 Alexei Starovoitov 2021-09-16  6511  	}
98beca42488374 Alexei Starovoitov 2021-09-16  6512  	if (relo->kind != BPF_CORE_TYPE_ID_LOCAL) {
98beca42488374 Alexei Starovoitov 2021-09-16  6513  		cands = bpf_core_find_cands(btf, relo->type_id);
98beca42488374 Alexei Starovoitov 2021-09-16  6514  		if (IS_ERR(cands)) {
98beca42488374 Alexei Starovoitov 2021-09-16  6515  			btf_put(btf);
98beca42488374 Alexei Starovoitov 2021-09-16  6516  			printk("target candidate search failed for %d\n",
98beca42488374 Alexei Starovoitov 2021-09-16  6517  			       relo->type_id);
98beca42488374 Alexei Starovoitov 2021-09-16  6518                          return PTR_ERR(cands);
98beca42488374 Alexei Starovoitov 2021-09-16  6519                  }
98beca42488374 Alexei Starovoitov 2021-09-16  6520  	}
98beca42488374 Alexei Starovoitov 2021-09-16  6521  	core_relo.type_id = relo->type_id;
98beca42488374 Alexei Starovoitov 2021-09-16  6522  	core_relo.access_str_off = relo->access_str_off;
98beca42488374 Alexei Starovoitov 2021-09-16  6523  	core_relo.kind = relo->kind;
98beca42488374 Alexei Starovoitov 2021-09-16 @6524  	err = bpf_core_apply_relo_insn("prog_name", insn, 0, &core_relo, 0, btf, cands);
98beca42488374 Alexei Starovoitov 2021-09-16  6525  	btf_put(btf);
98beca42488374 Alexei Starovoitov 2021-09-16  6526  	return 0;
fab12a1832b619 Alexei Starovoitov 2021-09-08  6527  }
fab12a1832b619 Alexei Starovoitov 2021-09-08  6528

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 30149 bytes --]

  reply	other threads:[~2021-09-20  3:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-19  9:44 [ast-bpf:relo_core 5/11] kernel/bpf/btf.c:6524:2: warning: Value stored to 'err' is never read [clang-analyzer-deadcode.DeadStores] kernel test robot
2021-09-20  3:45 ` kernel test robot [this message]
2021-09-20  3:45   ` kernel test robot

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=85ad33a4-2255-63dc-abab-36d62df6ae35@intel.com \
    --to=yujie.liu@intel.com \
    --cc=ast@kernel.org \
    --cc=kbuild-all@lists.01.org \
    --cc=linux-kernel@vger.kernel.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 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.