[toke:xdp-queueing-03 7/9] kernel/bpf/verifier.c:1580:39: sparse: sparse: mixing different enum types:

From: kernel test robot
Date: Sun Mar 13 2022 - 20:17:25 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/toke/linux.git xdp-queueing-03
head: 3e7f25d58b1bfd5ad623678bf9e11f27c98a8094
commit: 28d9ca982b9ae96bcad2bee81647ba18ae049a69 [7/9] bpf: Enable direct packet access for dequeue packets
config: s390-randconfig-s031-20220313 (https://download.01.org/0day-ci/archive/20220314/202203140808.WyoqkliI-lkp@xxxxxxxxx/config)
compiler: s390-linux-gcc (GCC) 11.2.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.4-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/toke/linux.git/commit/?id=28d9ca982b9ae96bcad2bee81647ba18ae049a69
git remote add toke https://git.kernel.org/pub/scm/linux/kernel/git/toke/linux.git
git fetch --no-tags toke xdp-queueing-03
git checkout 28d9ca982b9ae96bcad2bee81647ba18ae049a69
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=s390 SHELL=/bin/bash

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


sparse warnings: (new ones prefixed by >>)
>> kernel/bpf/verifier.c:1580:39: sparse: sparse: mixing different enum types:
>> kernel/bpf/verifier.c:1580:39: sparse: unsigned int enum bpf_reg_type
>> kernel/bpf/verifier.c:1580:39: sparse: unsigned int enum bpf_type_flag
kernel/bpf/verifier.c:13799:38: sparse: sparse: subtraction of functions? Share your drugs
kernel/bpf/verifier.c: note: in included file (through include/linux/bpf.h, include/linux/bpf-cgroup.h):
include/linux/bpfptr.h:52:47: sparse: sparse: cast to non-scalar
include/linux/bpfptr.h:52:47: sparse: sparse: cast from non-scalar
include/linux/bpfptr.h:63:40: sparse: sparse: cast to non-scalar
include/linux/bpfptr.h:63:40: sparse: sparse: cast from non-scalar
include/linux/bpfptr.h:52:47: sparse: sparse: cast to non-scalar
include/linux/bpfptr.h:52:47: sparse: sparse: cast from non-scalar
include/linux/bpfptr.h:63:40: sparse: sparse: cast to non-scalar
include/linux/bpfptr.h:63:40: sparse: sparse: cast from non-scalar
include/linux/bpfptr.h:52:47: sparse: sparse: cast to non-scalar
include/linux/bpfptr.h:52:47: sparse: sparse: cast from non-scalar
include/linux/bpfptr.h:63:40: sparse: sparse: cast to non-scalar
include/linux/bpfptr.h:63:40: sparse: sparse: cast from non-scalar
include/linux/bpfptr.h:52:47: sparse: sparse: cast to non-scalar
include/linux/bpfptr.h:52:47: sparse: sparse: cast from non-scalar
include/linux/bpfptr.h:52:47: sparse: sparse: cast to non-scalar
include/linux/bpfptr.h:52:47: sparse: sparse: cast from non-scalar

vim +1580 kernel/bpf/verifier.c

1568
1569 static void mark_btf_ld_reg(struct bpf_verifier_env *env,
1570 struct bpf_reg_state *regs, u32 regno,
1571 enum bpf_reg_type reg_type,
1572 struct btf *btf, u32 reg_id,
1573 enum bpf_type_flag flag)
1574 {
1575 if (reg_type == SCALAR_VALUE) {
1576 mark_reg_unknown(env, regs, regno);
1577 return;
1578 }
1579 mark_reg_known_zero(env, regs, regno);
> 1580 regs[regno].type = reg_type | flag;
1581 /* If not PTR_TO_BTF_ID, it is a pkt pointer */
1582 if (reg_type != PTR_TO_BTF_ID) {
1583 regs[regno].pkt_uid = reg_id;
1584 return;
1585 }
1586 regs[regno].btf = btf;
1587 regs[regno].btf_id = reg_id;
1588 }
1589

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