drivers/vhost/vhost.c:1035:16: sparse: sparse: restricted __virtio16 degrades to integer

From: kernel test robot
Date: Tue Aug 10 2021 - 13:15:03 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 9a73fa375d58fee5262dd16473c8e7522bdf44de
commit: d877322bc1adcab9850732275670409e8bcca4c4 openrisc: Fix issue with get_user for 64-bit values
date: 11 months ago
config: openrisc-randconfig-s031-20210810 (attached as .config)
compiler: or1k-linux-gcc (GCC) 10.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.3-348-gf0e6938b-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=d877322bc1adcab9850732275670409e8bcca4c4
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout d877322bc1adcab9850732275670409e8bcca4c4
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-10.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=openrisc SHELL=/bin/bash drivers/vhost/

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


sparse warnings: (new ones prefixed by >>)
drivers/vhost/vhost.c:1035:16: sparse: sparse: cast to restricted __virtio16
drivers/vhost/vhost.c:1035:16: sparse: sparse: cast to restricted __virtio16
drivers/vhost/vhost.c:1035:16: sparse: sparse: cast to restricted __virtio16
>> drivers/vhost/vhost.c:1035:16: sparse: sparse: restricted __virtio16 degrades to integer
>> drivers/vhost/vhost.c:1035:16: sparse: sparse: restricted __virtio16 degrades to integer
drivers/vhost/vhost.c:1035:16: sparse: sparse: cast to restricted __virtio16
drivers/vhost/vhost.c:1035:16: sparse: sparse: cast to restricted __virtio16
drivers/vhost/vhost.c:1035:16: sparse: sparse: cast to restricted __virtio16
drivers/vhost/vhost.c:1035:16: sparse: sparse: cast to restricted __virtio16
drivers/vhost/vhost.c:1035:16: sparse: sparse: cast to restricted __virtio16
>> drivers/vhost/vhost.c:1035:16: sparse: sparse: restricted __virtio16 degrades to integer
>> drivers/vhost/vhost.c:1035:16: sparse: sparse: restricted __virtio16 degrades to integer
drivers/vhost/vhost.c:1035:16: sparse: sparse: cast to restricted __virtio16
drivers/vhost/vhost.c:1035:16: sparse: sparse: cast to restricted __virtio16
drivers/vhost/vhost.c:1010:16: sparse: sparse: cast to restricted __virtio16
drivers/vhost/vhost.c:1010:16: sparse: sparse: cast to restricted __virtio16
drivers/vhost/vhost.c:1010:16: sparse: sparse: cast to restricted __virtio16
drivers/vhost/vhost.c:1010:16: sparse: sparse: restricted __virtio16 degrades to integer
drivers/vhost/vhost.c:1010:16: sparse: sparse: restricted __virtio16 degrades to integer
drivers/vhost/vhost.c:1010:16: sparse: sparse: cast to restricted __virtio16
drivers/vhost/vhost.c:1010:16: sparse: sparse: cast to restricted __virtio16
drivers/vhost/vhost.c:1010:16: sparse: sparse: cast to restricted __virtio16
drivers/vhost/vhost.c:1010:16: sparse: sparse: cast to restricted __virtio16
drivers/vhost/vhost.c:1010:16: sparse: sparse: cast to restricted __virtio16
drivers/vhost/vhost.c:1010:16: sparse: sparse: restricted __virtio16 degrades to integer
drivers/vhost/vhost.c:1010:16: sparse: sparse: restricted __virtio16 degrades to integer
drivers/vhost/vhost.c:1010:16: sparse: sparse: cast to restricted __virtio16
drivers/vhost/vhost.c:1010:16: sparse: sparse: cast to restricted __virtio16
drivers/vhost/vhost.c:1016:16: sparse: sparse: cast to restricted __virtio16
drivers/vhost/vhost.c:1016:16: sparse: sparse: cast to restricted __virtio16
drivers/vhost/vhost.c:1016:16: sparse: sparse: cast to restricted __virtio16
drivers/vhost/vhost.c:1016:16: sparse: sparse: restricted __virtio16 degrades to integer
drivers/vhost/vhost.c:1016:16: sparse: sparse: restricted __virtio16 degrades to integer
drivers/vhost/vhost.c:1016:16: sparse: sparse: cast to restricted __virtio16
drivers/vhost/vhost.c:1016:16: sparse: sparse: cast to restricted __virtio16
drivers/vhost/vhost.c:1016:16: sparse: sparse: cast to restricted __virtio16
drivers/vhost/vhost.c:1016:16: sparse: sparse: cast to restricted __virtio16
drivers/vhost/vhost.c:1016:16: sparse: sparse: cast to restricted __virtio16
drivers/vhost/vhost.c:1016:16: sparse: sparse: restricted __virtio16 degrades to integer
drivers/vhost/vhost.c:1016:16: sparse: sparse: restricted __virtio16 degrades to integer
drivers/vhost/vhost.c:1016:16: sparse: sparse: cast to restricted __virtio16
drivers/vhost/vhost.c:1016:16: sparse: sparse: cast to restricted __virtio16
drivers/vhost/vhost.c:1023:16: sparse: sparse: cast to restricted __virtio16
drivers/vhost/vhost.c:1023:16: sparse: sparse: cast to restricted __virtio16
drivers/vhost/vhost.c:1023:16: sparse: sparse: cast to restricted __virtio16
drivers/vhost/vhost.c:1023:16: sparse: sparse: restricted __virtio16 degrades to integer
drivers/vhost/vhost.c:1023:16: sparse: sparse: restricted __virtio16 degrades to integer
drivers/vhost/vhost.c:1023:16: sparse: sparse: cast to restricted __virtio16
drivers/vhost/vhost.c:1023:16: sparse: sparse: cast to restricted __virtio16
drivers/vhost/vhost.c:1023:16: sparse: sparse: cast to restricted __virtio16
drivers/vhost/vhost.c:1023:16: sparse: sparse: cast to restricted __virtio16
drivers/vhost/vhost.c:1023:16: sparse: sparse: cast to restricted __virtio16
drivers/vhost/vhost.c:1023:16: sparse: sparse: restricted __virtio16 degrades to integer
drivers/vhost/vhost.c:1023:16: sparse: sparse: restricted __virtio16 degrades to integer
drivers/vhost/vhost.c:1023:16: sparse: sparse: cast to restricted __virtio16
drivers/vhost/vhost.c:1023:16: sparse: sparse: cast to restricted __virtio16
drivers/vhost/vhost.c:1029:16: sparse: sparse: cast to restricted __virtio16
drivers/vhost/vhost.c:1029:16: sparse: sparse: cast to restricted __virtio16
drivers/vhost/vhost.c:1029:16: sparse: sparse: cast to restricted __virtio16
drivers/vhost/vhost.c:1029:16: sparse: sparse: restricted __virtio16 degrades to integer
drivers/vhost/vhost.c:1029:16: sparse: sparse: restricted __virtio16 degrades to integer
drivers/vhost/vhost.c:1029:16: sparse: sparse: cast to restricted __virtio16
drivers/vhost/vhost.c:1029:16: sparse: sparse: cast to restricted __virtio16
drivers/vhost/vhost.c:1029:16: sparse: sparse: cast to restricted __virtio16
drivers/vhost/vhost.c:1029:16: sparse: sparse: cast to restricted __virtio16
drivers/vhost/vhost.c:1029:16: sparse: sparse: cast to restricted __virtio16
drivers/vhost/vhost.c:1029:16: sparse: sparse: restricted __virtio16 degrades to integer
drivers/vhost/vhost.c:1029:16: sparse: sparse: restricted __virtio16 degrades to integer
drivers/vhost/vhost.c:1029:16: sparse: sparse: cast to restricted __virtio16
drivers/vhost/vhost.c:1029:16: sparse: sparse: cast to restricted __virtio16
drivers/vhost/vhost.c:1010:16: sparse: sparse: cast to restricted __virtio16
drivers/vhost/vhost.c:1010:16: sparse: sparse: cast to restricted __virtio16
drivers/vhost/vhost.c:1010:16: sparse: sparse: cast to restricted __virtio16
drivers/vhost/vhost.c:1010:16: sparse: sparse: cast to restricted __virtio16
drivers/vhost/vhost.c:1010:16: sparse: sparse: cast to restricted __virtio16
drivers/vhost/vhost.c:1010:16: sparse: sparse: cast to restricted __virtio16
drivers/vhost/vhost.c:1010:16: sparse: sparse: cast to restricted __virtio16
drivers/vhost/vhost.c:1010:16: sparse: sparse: cast to restricted __virtio16
drivers/vhost/vhost.c:1010:16: sparse: sparse: cast to restricted __virtio16
drivers/vhost/vhost.c:1010:16: sparse: sparse: cast to restricted __virtio16
drivers/vhost/vhost.c:1010:16: sparse: sparse: cast to restricted __virtio16
drivers/vhost/vhost.c:1010:16: sparse: sparse: cast to restricted __virtio16
drivers/vhost/vhost.c:1010:16: sparse: sparse: cast to restricted __virtio16
drivers/vhost/vhost.c:1010:16: sparse: sparse: cast to restricted __virtio16
drivers/vhost/vhost.c:1010:16: sparse: sparse: cast to restricted __virtio16
drivers/vhost/vhost.c:1010:16: sparse: sparse: cast to restricted __virtio16
drivers/vhost/vhost.c:1010:16: sparse: sparse: cast to restricted __virtio16
drivers/vhost/vhost.c:1010:16: sparse: sparse: cast to restricted __virtio16
drivers/vhost/vhost.c:1010:16: sparse: sparse: cast to restricted __virtio16
drivers/vhost/vhost.c:1010:16: sparse: sparse: cast to restricted __virtio16

vim +1035 drivers/vhost/vhost.c

7b5d753ebc22c5 Jason Wang 2019-05-24 1031
7b5d753ebc22c5 Jason Wang 2019-05-24 1032 static inline int vhost_get_used_idx(struct vhost_virtqueue *vq,
7b5d753ebc22c5 Jason Wang 2019-05-24 1033 __virtio16 *idx)
7b5d753ebc22c5 Jason Wang 2019-05-24 1034 {
7b5d753ebc22c5 Jason Wang 2019-05-24 @1035 return vhost_get_used(vq, *idx, &vq->used->idx);
7b5d753ebc22c5 Jason Wang 2019-05-24 1036 }
7b5d753ebc22c5 Jason Wang 2019-05-24 1037

:::::: The code at line 1035 was first introduced by commit
:::::: 7b5d753ebc22c5b6935a70ce9a857dc6220784f8 vhost: fine grain userspace memory accessors

:::::: TO: Jason Wang <jasowang@xxxxxxxxxx>
:::::: CC: Michael S. Tsirkin <mst@xxxxxxxxxx>

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

Attachment: .config.gz
Description: application/gzip