[toke:xdp-queueing-03 3/9] net/bpf/test_run.c:1372:15: warning: cast to pointer from integer of different size

From: kernel test robot
Date: Fri Mar 11 2022 - 07:00:06 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/toke/linux.git xdp-queueing-03
head: 91c92d46077f70b03fd162128dd3373663d529d4
commit: eb1f31b3643b9fb49f4785deab32e3461eca777f [3/9] xdp: add dequeue program type for getting packets from a PIFO
config: xtensa-buildonly-randconfig-r004-20220310 (https://download.01.org/0day-ci/archive/20220311/202203111957.Pexg2qR6-lkp@xxxxxxxxx/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://git.kernel.org/pub/scm/linux/kernel/git/toke/linux.git/commit/?id=eb1f31b3643b9fb49f4785deab32e3461eca777f
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 eb1f31b3643b9fb49f4785deab32e3461eca777f
# 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=xtensa SHELL=/bin/bash net/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 >>):

net/bpf/test_run.c: In function 'bpf_prog_test_run_dequeue':
>> net/bpf/test_run.c:1372:15: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
1372 | pkt = (void *)retval;
| ^


vim +1372 net/bpf/test_run.c

1347
1348 int bpf_prog_test_run_dequeue(struct bpf_prog *prog, const union bpf_attr *kattr,
1349 union bpf_attr __user *uattr)
1350 {
1351 struct xdp_txq_info txq = { .dev = current->nsproxy->net_ns->loopback_dev };
1352 u32 repeat = kattr->test.repeat, duration, size;
1353 struct dequeue_data ctx = { .txq = &txq };
1354 struct xdp_buff xdp = {};
1355 struct xdp_frame *pkt;
1356 int ret = -EINVAL;
1357 u64 retval;
1358
1359 if (prog->expected_attach_type)
1360 return -EINVAL;
1361
1362 if (kattr->test.data_in || kattr->test.data_size_in ||
1363 kattr->test.ctx_in || kattr->test.ctx_out || repeat > 1)
1364 return -EINVAL;
1365
1366 ret = bpf_test_run(prog, &ctx, repeat, &retval, &duration, false);
1367 if (ret)
1368 return ret;
1369 if (!retval)
1370 return bpf_test_finish(kattr, uattr, NULL, NULL, 0, retval, duration);
1371
> 1372 pkt = (void *)retval;
1373 xdp_convert_frame_to_buff(pkt, &xdp);
1374 size = xdp.data_end - xdp.data_meta;
1375 /* We set retval == 1 if pkt != NULL, otherwise 0 */
1376 ret = bpf_test_finish(kattr, uattr, xdp.data_meta, NULL, size, !!retval, duration);
1377 xdp_return_frame(pkt);
1378 return ret;
1379 }
1380

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