CC: [email protected] CC: [email protected] CC: [email protected] TO: Alexei Starovoitov <[email protected]>
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 <[email protected]> clang-analyzer warnings: (new ones prefixed by >>) kernel/sysctl.c:1578:4: note: Taking false branch if (err) ^ kernel/sysctl.c:1580:8: note: Assuming 'val_a' is < 'bitmap_len' if (val_a >= bitmap_len || neg) { ^~~~~~~~~~~~~~~~~~~ kernel/sysctl.c:1580:8: note: Left side of '||' is false kernel/sysctl.c:1580:31: note: 'neg' is false if (val_a >= bitmap_len || neg) { ^~~ kernel/sysctl.c:1580:4: note: Taking false branch if (val_a >= bitmap_len || neg) { ^ kernel/sysctl.c:1586:8: note: Assuming 'left' is 0 if (left) { ^~~~ kernel/sysctl.c:1586:4: note: Taking false branch if (left) { ^ kernel/sysctl.c:1591:10: note: The left operand of '==' is a garbage value if (c == '-') { ~ ^ Suppressed 10 warnings (3 in non-user code, 7 with check filters). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 9 warnings generated. Suppressed 9 warnings (2 in non-user code, 7 with check filters). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 9 warnings generated. Suppressed 9 warnings (2 in non-user code, 7 with check filters). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 9 warnings generated. Suppressed 9 warnings (2 in non-user code, 7 with check filters). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 9 warnings generated. Suppressed 9 warnings (2 in non-user code, 7 with check filters). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 9 warnings generated. Suppressed 9 warnings (2 in non-user code, 7 with check filters). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 9 warnings generated. Suppressed 9 warnings (2 in non-user code, 7 with check filters). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 9 warnings generated. Suppressed 9 warnings (2 in non-user code, 7 with check filters). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 10 warnings generated. Suppressed 10 warnings (3 in non-user code, 7 with check filters). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 10 warnings generated. Suppressed 10 warnings (3 in non-user code, 7 with check filters). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 10 warnings generated. Suppressed 10 warnings (3 in non-user code, 7 with check filters). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 10 warnings generated. Suppressed 10 warnings (3 in non-user code, 7 with check filters). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 9 warnings generated. Suppressed 9 warnings (2 in non-user code, 7 with check filters). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 10 warnings generated. Suppressed 10 warnings (3 in non-user code, 7 with check filters). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 2 warnings generated. Suppressed 2 warnings (2 in non-user code). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 10 warnings generated. Suppressed 10 warnings (3 in non-user code, 7 with check filters). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 10 warnings generated. Suppressed 10 warnings (3 in non-user code, 7 with check filters). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 10 warnings generated. Suppressed 10 warnings (3 in non-user code, 7 with check filters). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 10 warnings generated. Suppressed 10 warnings (3 in non-user code, 7 with check filters). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 2 warnings generated. Suppressed 2 warnings (2 in non-user code). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 10 warnings generated. Suppressed 10 warnings (2 in non-user code, 8 with check filters). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 10 warnings generated. Suppressed 10 warnings (3 in non-user code, 7 with check filters). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 10 warnings generated. Suppressed 10 warnings (3 in non-user code, 7 with check filters). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 2 warnings generated. Suppressed 2 warnings (2 in non-user code). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 12 warnings generated. kernel/bpf/btf.c:838:25: warning: Value stored to 't' during its initialization is never read [clang-analyzer-deadcode.DeadStores] const struct btf_type *t = show->state.type; ^ ~~~~~~~~~~~~~~~~ kernel/bpf/btf.c:838:25: note: Value stored to 't' during its initialization is never read const struct btf_type *t = show->state.type; ^ ~~~~~~~~~~~~~~~~ >> 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); ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ kernel/bpf/btf.c:6524:2: note: Value stored to 'err' is never read err = bpf_core_apply_relo_insn("prog_name", insn, 0, &core_relo, 0, btf, cands); ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Suppressed 10 warnings (2 in non-user code, 8 with check filters). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 10 warnings generated. include/linux/log2.h:57:13: warning: The result of the left shift is undefined due to shifting by '64', which is greater or equal to the width of type 'unsigned long' [clang-analyzer-core.UndefinedBinaryOperatorResult] return 1UL << fls_long(n - 1); ^ kernel/bpf/devmap.c:162:6: note: Assuming the condition is false if (!capable(CAP_NET_ADMIN)) ^~~~~~~~~~~~~~~~~~~~~~~ kernel/bpf/devmap.c:162:2: note: Taking false branch if (!capable(CAP_NET_ADMIN)) ^ kernel/bpf/devmap.c:166:6: note: Assuming 'dtab' is non-null if (!dtab) ^~~~~ kernel/bpf/devmap.c:166:2: note: Taking false branch if (!dtab) ^ kernel/bpf/devmap.c:169:8: note: Calling 'dev_map_init_map' err = dev_map_init_map(dtab, attr); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ kernel/bpf/devmap.c:118:6: note: Assuming field 'max_entries' is not equal to 0 if (attr->max_entries == 0 || attr->key_size != 4 || ^~~~~~~~~~~~~~~~~~~~~~ kernel/bpf/devmap.c:118:6: note: Left side of '||' is false kernel/bpf/devmap.c:118:32: note: Assuming field 'key_size' is equal to 4 if (attr->max_entries == 0 || attr->key_size != 4 || ^~~~~~~~~~~~~~~~~~~ kernel/bpf/devmap.c:118:6: note: Left side of '||' is false if (attr->max_entries == 0 || attr->key_size != 4 || ^ kernel/bpf/devmap.c:119:7: note: Assuming the condition is false (valsize != offsetofend(struct bpf_devmap_val, ifindex) && ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ kernel/bpf/devmap.c:119:62: note: Left side of '&&' is false (valsize != offsetofend(struct bpf_devmap_val, ifindex) && ^ kernel/bpf/devmap.c:121:6: note: Assuming the condition is false attr->map_flags & ~DEV_CREATE_FLAG_MASK) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ kernel/bpf/devmap.c:118:2: note: Taking false branch if (attr->max_entries == 0 || attr->key_size != 4 || ^ kernel/bpf/devmap.c:132:6: note: Assuming field 'map_type' is equal to BPF_MAP_TYPE_DEVMAP_HASH if (attr->map_type == BPF_MAP_TYPE_DEVMAP_HASH) { ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ kernel/bpf/devmap.c:132:2: note: Taking true branch if (attr->map_type == BPF_MAP_TYPE_DEVMAP_HASH) { ^ kernel/bpf/devmap.c:133:21: note: '?' condition is false dtab->n_buckets = roundup_pow_of_two(dtab->map.max_entries); ^ include/linux/log2.h:176:2: note: expanded from macro 'roundup_pow_of_two' __builtin_constant_p(n) ? ( \ ^ kernel/bpf/devmap.c:133:21: note: Calling '__roundup_pow_of_two' dtab->n_buckets = roundup_pow_of_two(dtab->map.max_entries); ^ include/linux/log2.h:180:2: note: expanded from macro 'roundup_pow_of_two' __roundup_pow_of_two(n) \ ^~~~~~~~~~~~~~~~~~~~~~~ include/linux/log2.h:57:16: note: Calling 'fls_long' return 1UL << fls_long(n - 1); ^~~~~~~~~~~~~~~ include/linux/bitops.h:188:2: note: Taking false branch if (sizeof(l) == 4) ^ include/linux/bitops.h:190:9: note: Calling 'fls64' return fls64(l); ^~~~~~~~ include/asm-generic/bitops/fls64.h:29:6: note: Assuming 'x' is not equal to 0 if (x == 0) ^~~~~~ include/asm-generic/bitops/fls64.h:29:2: note: Taking false branch if (x == 0) ^ include/asm-generic/bitops/fls64.h:31:2: note: Returning the value 64 return __fls(x) + 1; ^~~~~~~~~~~~~~~~~~~ include/linux/bitops.h:190:9: note: Returning from 'fls64' return fls64(l); ^~~~~~~~ include/linux/bitops.h:190:2: note: Returning the value 64 return fls64(l); ^~~~~~~~~~~~~~~ include/linux/log2.h:57:16: note: Returning from 'fls_long' return 1UL << fls_long(n - 1); ^~~~~~~~~~~~~~~ include/linux/log2.h:57:13: note: The result of the left shift is undefined due to shifting by '64', which is greater or equal to the width of type 'unsigned long' return 1UL << fls_long(n - 1); ^ ~~~~~~~~~~~~~~~ Suppressed 9 warnings (2 in non-user code, 7 with check filters). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 9 warnings generated. Suppressed 9 warnings (2 in non-user code, 7 with check filters). 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/[email protected]
.config.gz
Description: application/gzip
_______________________________________________ kbuild mailing list -- [email protected] To unsubscribe send an email to [email protected]
