kernel/bpf/verifier.c:1776:21: error: unused variable 'kfunc_btf'

From: kernel test robot
Date: Fri Oct 08 2021 - 23:59:44 EST


tree: https://github.com/0day-ci/linux/commits/UPDATE-20211009-062812/Kumar-Kartikeya-Dwivedi/bpf-Silence-Coverity-warning-for-find_kfunc_desc_btf/20211009-010928
head: aff5b53e62a423701f59205b644916bae36c96c3
commit: aff5b53e62a423701f59205b644916bae36c96c3 bpf: Silence Coverity warning for find_kfunc_desc_btf
date: 6 hours ago
config: microblaze-buildonly-randconfig-r003-20211008 (attached as .config)
compiler: microblaze-linux-gcc (GCC) 11.2.0
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/aff5b53e62a423701f59205b644916bae36c96c3
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review UPDATE-20211009-062812/Kumar-Kartikeya-Dwivedi/bpf-Silence-Coverity-warning-for-find_kfunc_desc_btf/20211009-010928
git checkout aff5b53e62a423701f59205b644916bae36c96c3
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=microblaze

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

All errors (new ones prefixed by >>):

kernel/bpf/verifier.c: In function 'find_kfunc_desc_btf':
>> kernel/bpf/verifier.c:1776:21: error: unused variable 'kfunc_btf' [-Werror=unused-variable]
1776 | struct btf *kfunc_btf;
| ^~~~~~~~~
cc1: all warnings being treated as errors


vim +/kfunc_btf +1776 kernel/bpf/verifier.c

2357672c54c3f748 Kumar Kartikeya Dwivedi 2021-10-02 1771
2357672c54c3f748 Kumar Kartikeya Dwivedi 2021-10-02 1772 static struct btf *find_kfunc_desc_btf(struct bpf_verifier_env *env,
2357672c54c3f748 Kumar Kartikeya Dwivedi 2021-10-02 1773 u32 func_id, s16 offset,
2357672c54c3f748 Kumar Kartikeya Dwivedi 2021-10-02 1774 struct module **btf_modp)
2357672c54c3f748 Kumar Kartikeya Dwivedi 2021-10-02 1775 {
2357672c54c3f748 Kumar Kartikeya Dwivedi 2021-10-02 @1776 struct btf *kfunc_btf;
2357672c54c3f748 Kumar Kartikeya Dwivedi 2021-10-02 1777
2357672c54c3f748 Kumar Kartikeya Dwivedi 2021-10-02 1778 if (offset) {
2357672c54c3f748 Kumar Kartikeya Dwivedi 2021-10-02 1779 if (offset < 0) {
2357672c54c3f748 Kumar Kartikeya Dwivedi 2021-10-02 1780 /* In the future, this can be allowed to increase limit
2357672c54c3f748 Kumar Kartikeya Dwivedi 2021-10-02 1781 * of fd index into fd_array, interpreted as u16.
2357672c54c3f748 Kumar Kartikeya Dwivedi 2021-10-02 1782 */
2357672c54c3f748 Kumar Kartikeya Dwivedi 2021-10-02 1783 verbose(env, "negative offset disallowed for kernel module function call\n");
2357672c54c3f748 Kumar Kartikeya Dwivedi 2021-10-02 1784 return ERR_PTR(-EINVAL);
2357672c54c3f748 Kumar Kartikeya Dwivedi 2021-10-02 1785 }
2357672c54c3f748 Kumar Kartikeya Dwivedi 2021-10-02 1786
aff5b53e62a42370 Kumar Kartikeya Dwivedi 2021-10-09 1787 return __find_kfunc_desc_btf(env, offset, btf_modp);
2357672c54c3f748 Kumar Kartikeya Dwivedi 2021-10-02 1788 }
2357672c54c3f748 Kumar Kartikeya Dwivedi 2021-10-02 1789 return btf_vmlinux ?: ERR_PTR(-ENOENT);
e6ac2450d6dee312 Martin KaFai Lau 2021-03-24 1790 }
e6ac2450d6dee312 Martin KaFai Lau 2021-03-24 1791

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

Attachment: .config.gz
Description: application/gzip