[congwang:sch_bpf2 2/2] kernel/bpf/btf.c:4422:9: error: initialized field overwritten

From: kernel test robot
Date: Sun Sep 12 2021 - 23:04:53 EST


tree: https://github.com/congwang/linux.git sch_bpf2
head: 605f886c8f746c2b592e404357408911e7e05ee6
commit: 605f886c8f746c2b592e404357408911e7e05ee6 [2/2] net_sched: introduce eBPF based Qdisc
config: xtensa-allyesconfig (attached as .config)
compiler: xtensa-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/congwang/linux/commit/605f886c8f746c2b592e404357408911e7e05ee6
git remote add congwang https://github.com/congwang/linux.git
git fetch --no-tags congwang sch_bpf2
git checkout 605f886c8f746c2b592e404357408911e7e05ee6
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=xtensa

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/btf.c:4422:9: error: initialized field overwritten [-Werror=override-init]
4422 | 0, /* avoid empty array */
| ^
kernel/bpf/btf.c:4422:9: note: (near initialization for 'bpf_ctx_convert_map[32]')
kernel/bpf/btf.c: In function 'btf_seq_show':
kernel/bpf/btf.c:5748:29: error: function 'btf_seq_show' might be a candidate for 'gnu_printf' format attribute [-Werror=suggest-attribute=format]
5748 | seq_vprintf((struct seq_file *)show->target, fmt, args);
| ^~~~~~~~
kernel/bpf/btf.c: In function 'btf_snprintf_show':
kernel/bpf/btf.c:5785:9: error: function 'btf_snprintf_show' might be a candidate for 'gnu_printf' format attribute [-Werror=suggest-attribute=format]
5785 | len = vsnprintf(show->target, ssnprintf->len_left, fmt, args);
| ^~~
cc1: all warnings being treated as errors


vim +4422 kernel/bpf/btf.c

91cc1a99740e2e Alexei Starovoitov 2019-11-14 4396
91cc1a99740e2e Alexei Starovoitov 2019-11-14 4397 #define BPF_MAP_TYPE(_id, _ops)
f2e10bff16a0fd Andrii Nakryiko 2020-04-28 4398 #define BPF_LINK_TYPE(_id, _name)
91cc1a99740e2e Alexei Starovoitov 2019-11-14 4399 static union {
91cc1a99740e2e Alexei Starovoitov 2019-11-14 4400 struct bpf_ctx_convert {
91cc1a99740e2e Alexei Starovoitov 2019-11-14 4401 #define BPF_PROG_TYPE(_id, _name, prog_ctx_type, kern_ctx_type) \
91cc1a99740e2e Alexei Starovoitov 2019-11-14 4402 prog_ctx_type _id##_prog; \
91cc1a99740e2e Alexei Starovoitov 2019-11-14 4403 kern_ctx_type _id##_kern;
91cc1a99740e2e Alexei Starovoitov 2019-11-14 4404 #include <linux/bpf_types.h>
91cc1a99740e2e Alexei Starovoitov 2019-11-14 4405 #undef BPF_PROG_TYPE
91cc1a99740e2e Alexei Starovoitov 2019-11-14 4406 } *__t;
91cc1a99740e2e Alexei Starovoitov 2019-11-14 4407 /* 't' is written once under lock. Read many times. */
91cc1a99740e2e Alexei Starovoitov 2019-11-14 4408 const struct btf_type *t;
91cc1a99740e2e Alexei Starovoitov 2019-11-14 4409 } bpf_ctx_convert;
91cc1a99740e2e Alexei Starovoitov 2019-11-14 4410 enum {
91cc1a99740e2e Alexei Starovoitov 2019-11-14 4411 #define BPF_PROG_TYPE(_id, _name, prog_ctx_type, kern_ctx_type) \
91cc1a99740e2e Alexei Starovoitov 2019-11-14 4412 __ctx_convert##_id,
91cc1a99740e2e Alexei Starovoitov 2019-11-14 4413 #include <linux/bpf_types.h>
91cc1a99740e2e Alexei Starovoitov 2019-11-14 4414 #undef BPF_PROG_TYPE
ce27709b8162e5 Alexei Starovoitov 2019-11-27 4415 __ctx_convert_unused, /* to avoid empty enum in extreme .config */
91cc1a99740e2e Alexei Starovoitov 2019-11-14 4416 };
91cc1a99740e2e Alexei Starovoitov 2019-11-14 4417 static u8 bpf_ctx_convert_map[] = {
91cc1a99740e2e Alexei Starovoitov 2019-11-14 4418 #define BPF_PROG_TYPE(_id, _name, prog_ctx_type, kern_ctx_type) \
91cc1a99740e2e Alexei Starovoitov 2019-11-14 4419 [_id] = __ctx_convert##_id,
91cc1a99740e2e Alexei Starovoitov 2019-11-14 4420 #include <linux/bpf_types.h>
91cc1a99740e2e Alexei Starovoitov 2019-11-14 4421 #undef BPF_PROG_TYPE
4c80c7bc583a87 Arnd Bergmann 2019-12-10 @4422 0, /* avoid empty array */
91cc1a99740e2e Alexei Starovoitov 2019-11-14 4423 };
91cc1a99740e2e Alexei Starovoitov 2019-11-14 4424 #undef BPF_MAP_TYPE
f2e10bff16a0fd Andrii Nakryiko 2020-04-28 4425 #undef BPF_LINK_TYPE
91cc1a99740e2e Alexei Starovoitov 2019-11-14 4426

:::::: The code at line 4422 was first introduced by commit
:::::: 4c80c7bc583a87ded5f61906f81256b57c795806 bpf: Fix build in minimal configurations, again

:::::: TO: Arnd Bergmann <arnd@xxxxxxxx>
:::::: CC: Daniel Borkmann <daniel@xxxxxxxxxxxxx>

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

Attachment: .config.gz
Description: application/gzip