tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master head: ec2618180c3450d06a6a4ba951d4c9a2c689b517 commit: e2d5b2bb769fa5f500760caba76436ba3a10a895 [2296/2770] bpf: Fix nested bpf_bprintf_prepare with more per-cpu buffers compiler: sparc64-linux-gcc (GCC) 9.3.0 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp@xxxxxxxxx> cppcheck possible warnings: (new ones prefixed by >>, may not real problems) >> kernel/bpf/helpers.c:713:43: warning: Uninitialized variable: bufs [uninitvar] if (WARN_ON_ONCE(nest_level > ARRAY_SIZE(bufs->tmp_bufs))) { ^ kernel/bpf/helpers.c:408:20: warning: Possible null pointer dereference: storage [nullPointer] ptr = &READ_ONCE(storage->buf)->data[0]; ^ kernel/bpf/helpers.c:395:39: note: Assignment 'storage=NULL', assigned value is 0 struct bpf_cgroup_storage *storage = NULL; ^ kernel/bpf/helpers.c:408:20: note: Null pointer dereference ptr = &READ_ONCE(storage->buf)->data[0]; ^ vim +713 kernel/bpf/helpers.c d9c9e4db186ab4 Florent Revest 2021-04-19 705 d9c9e4db186ab4 Florent Revest 2021-04-19 706 static int try_get_fmt_tmp_buf(char **tmp_buf) d9c9e4db186ab4 Florent Revest 2021-04-19 707 { e2d5b2bb769fa5 Florent Revest 2021-05-11 708 struct bpf_bprintf_buffers *bufs; e2d5b2bb769fa5 Florent Revest 2021-05-11 709 int nest_level; d9c9e4db186ab4 Florent Revest 2021-04-19 710 d9c9e4db186ab4 Florent Revest 2021-04-19 711 preempt_disable(); e2d5b2bb769fa5 Florent Revest 2021-05-11 712 nest_level = this_cpu_inc_return(bpf_bprintf_nest_level); e2d5b2bb769fa5 Florent Revest 2021-05-11 @713 if (WARN_ON_ONCE(nest_level > ARRAY_SIZE(bufs->tmp_bufs))) { e2d5b2bb769fa5 Florent Revest 2021-05-11 714 this_cpu_dec(bpf_bprintf_nest_level); d9c9e4db186ab4 Florent Revest 2021-04-19 715 preempt_enable(); d9c9e4db186ab4 Florent Revest 2021-04-19 716 return -EBUSY; d9c9e4db186ab4 Florent Revest 2021-04-19 717 } e2d5b2bb769fa5 Florent Revest 2021-05-11 718 bufs = this_cpu_ptr(&bpf_bprintf_bufs); e2d5b2bb769fa5 Florent Revest 2021-05-11 719 *tmp_buf = bufs->tmp_bufs[nest_level - 1]; d9c9e4db186ab4 Florent Revest 2021-04-19 720 d9c9e4db186ab4 Florent Revest 2021-04-19 721 return 0; d9c9e4db186ab4 Florent Revest 2021-04-19 722 } d9c9e4db186ab4 Florent Revest 2021-04-19 723 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx