[ast-bpf:skel 1/5] kernel/bpf/syscall.c:4794:56: warning: cast to pointer from integer of different size

From: kernel test robot
Date: Thu Feb 03 2022 - 09:06:24 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/ast/bpf.git skel
head: 90109bb4d0dabc315c7fa82d193d9e7a54ee18c7
commit: e20a0273d1b34b0a5f1ec45b3ad2038b465f0b54 [1/5] bpf: Extend sys_bpf commands for bpf_syscall programs.
config: sh-allmodconfig (https://download.01.org/0day-ci/archive/20220203/202202031502.vruI1NMM-lkp@xxxxxxxxx/config)
compiler: sh4-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://git.kernel.org/pub/scm/linux/kernel/git/ast/bpf.git/commit/?id=e20a0273d1b34b0a5f1ec45b3ad2038b465f0b54
git remote add ast-bpf https://git.kernel.org/pub/scm/linux/kernel/git/ast/bpf.git
git fetch --no-tags ast-bpf skel
git checkout e20a0273d1b34b0a5f1ec45b3ad2038b465f0b54
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=sh SHELL=/bin/bash kernel/bpf/

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

All warnings (new ones prefixed by >>):

kernel/bpf/syscall.c: In function '____bpf_sys_bpf':
>> kernel/bpf/syscall.c:4794:56: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
4794 | attr->test.retval = bpf_prog_run(prog, (void *) attr->test.ctx_in);
| ^


vim +4794 kernel/bpf/syscall.c

4759
4760 BPF_CALL_3(bpf_sys_bpf, int, cmd, union bpf_attr *, attr, u32, attr_size)
4761 {
4762 struct bpf_prog *prog;
4763
4764 switch (cmd) {
4765 case BPF_MAP_CREATE:
4766 case BPF_MAP_UPDATE_ELEM:
4767 case BPF_MAP_FREEZE:
4768 case BPF_PROG_LOAD:
4769 case BPF_BTF_LOAD:
4770 case BPF_LINK_CREATE:
4771 case BPF_RAW_TRACEPOINT_OPEN:
4772 break;
4773 case BPF_PROG_TEST_RUN:
4774 if (attr->test.data_in || attr->test.data_out ||
4775 attr->test.ctx_out || attr->test.duration ||
4776 attr->test.repeat || attr->test.flags)
4777 return -EINVAL;
4778
4779 prog = bpf_prog_get_type(attr->test.prog_fd, BPF_PROG_TYPE_SYSCALL);
4780 if (IS_ERR(prog))
4781 return PTR_ERR(prog);
4782
4783 if (attr->test.ctx_size_in < prog->aux->max_ctx_offset ||
4784 attr->test.ctx_size_in > U16_MAX) {
4785 bpf_prog_put(prog);
4786 return -EINVAL;
4787 }
4788
4789 if (!__bpf_prog_enter_sleepable(prog)) {
4790 /* recursion detected */
4791 bpf_prog_put(prog);
4792 return -EBUSY;
4793 }
> 4794 attr->test.retval = bpf_prog_run(prog, (void *) attr->test.ctx_in);
4795 __bpf_prog_exit_sleepable(prog, 0 /* bpf_prog_run does runtime stats */);
4796 bpf_prog_put(prog);
4797 return 0;
4798 default:
4799 return -EINVAL;
4800 }
4801 return __sys_bpf(cmd, KERNEL_BPFPTR(attr), attr_size);
4802 }
4803 EXPORT_SYMBOL(bpf_sys_bpf);
4804

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