2022-06-06 05:36:24

by kernel test robot

[permalink] [raw]
Subject: drivers/vhost/vringh.c:586:18: sparse: sparse: restricted __virtio16 degrades to integer

tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 032dcf09e2bf7c822be25b4abef7a6c913870d98
commit: a97b693c3712f040c5802f32b2d685352e08cefa uaccess: fix nios2 and microblaze get_user_8()
date: 3 months ago
config: microblaze-randconfig-s031-20220603 (https://download.01.org/0day-ci/archive/20220604/[email protected]/config)
compiler: microblaze-linux-gcc (GCC) 11.3.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-18-g56afb504-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=a97b693c3712f040c5802f32b2d685352e08cefa
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout a97b693c3712f040c5802f32b2d685352e08cefa
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=microblaze SHELL=/bin/bash drivers/vhost/

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <[email protected]>


sparse warnings: (new ones prefixed by >>)
>> drivers/vhost/vringh.c:586:18: sparse: sparse: restricted __virtio16 degrades to integer
>> drivers/vhost/vringh.c:586:18: sparse: sparse: restricted __virtio16 degrades to integer
drivers/vhost/vringh.c:586:18: sparse: sparse: cast to restricted __virtio16

vim +586 drivers/vhost/vringh.c

f87d0fbb579818 Rusty Russell 2013-03-20 581
f87d0fbb579818 Rusty Russell 2013-03-20 582 /* Userspace access helpers: in this case, addresses are really userspace. */
b9f7ac8c72894c Michael S. Tsirkin 2014-12-12 583 static inline int getu16_user(const struct vringh *vrh, u16 *val, const __virtio16 *p)
f87d0fbb579818 Rusty Russell 2013-03-20 584 {
b9f7ac8c72894c Michael S. Tsirkin 2014-12-12 585 __virtio16 v = 0;
b9f7ac8c72894c Michael S. Tsirkin 2014-12-12 @586 int rc = get_user(v, (__force __virtio16 __user *)p);
b9f7ac8c72894c Michael S. Tsirkin 2014-12-12 587 *val = vringh16_to_cpu(vrh, v);
b9f7ac8c72894c Michael S. Tsirkin 2014-12-12 588 return rc;
f87d0fbb579818 Rusty Russell 2013-03-20 589 }
f87d0fbb579818 Rusty Russell 2013-03-20 590

:::::: The code at line 586 was first introduced by commit
:::::: b9f7ac8c72894c19bf258a54ecaa708df4ffbe80 vringh: update for virtio 1.0 APIs

:::::: TO: Michael S. Tsirkin <[email protected]>
:::::: CC: Michael S. Tsirkin <[email protected]dhat.com>

--
0-DAY CI Kernel Test Service
https://01.org/lkp