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

From: kernel test robot
Date: Sun Jun 21 2020 - 11:43:53 EST


Hi Jason,

First bad commit (maybe != root cause):

tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 64677779e8962c20b580b471790fe42367750599
commit: 20c384f1ea1a0bc7320bc445c72dd02d2970d594 vhost: refine vhost and vringh kconfig
date: 3 months ago
config: riscv-randconfig-s031-20200621 (attached as .config)
compiler: riscv32-linux-gcc (GCC) 9.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.2-rc2-13-gc59158c8-dirty
git checkout 20c384f1ea1a0bc7320bc445c72dd02d2970d594
# save the attached .config to linux build tree
make W=1 C=1 ARCH=riscv CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'

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:753:17: sparse: sparse: incorrect type in return expression (different address spaces) @@ expected void [noderef] <asn:1> * @@ got void * @@
drivers/vhost/vhost.c:753:17: sparse: expected void [noderef] <asn:1> *
drivers/vhost/vhost.c:753:17: sparse: got void *
drivers/vhost/vhost.c:753:17: sparse: sparse: incorrect type in return expression (different address spaces) @@ expected void [noderef] <asn:1> * @@ got void * @@
drivers/vhost/vhost.c:753:17: sparse: expected void [noderef] <asn:1> *
drivers/vhost/vhost.c:753:17: sparse: got void *
drivers/vhost/vhost.c:753:17: sparse: sparse: incorrect type in return expression (different address spaces) @@ expected void [noderef] <asn:1> * @@ got void * @@
drivers/vhost/vhost.c:753:17: sparse: expected void [noderef] <asn:1> *
drivers/vhost/vhost.c:753:17: sparse: got void *
>> drivers/vhost/vhost.c:937:16: sparse: sparse: restricted __virtio16 degrades to integer
>> drivers/vhost/vhost.c:937:16: sparse: sparse: restricted __virtio16 degrades to integer
drivers/vhost/vhost.c:937:16: sparse: sparse: cast from restricted __virtio16
drivers/vhost/vhost.c:937:16: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void *addr @@ got restricted __virtio16 [noderef] <asn:1> * @@
drivers/vhost/vhost.c:937:16: sparse: expected void *addr
drivers/vhost/vhost.c:937:16: sparse: got restricted __virtio16 [noderef] <asn:1> *
>> drivers/vhost/vhost.c:937:16: sparse: sparse: restricted __virtio16 degrades to integer
>> drivers/vhost/vhost.c:937:16: sparse: sparse: restricted __virtio16 degrades to integer
drivers/vhost/vhost.c:937:16: sparse: sparse: cast from restricted __virtio16
drivers/vhost/vhost.c:900:42: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void [noderef] <asn:1> *addr @@ got void *addr @@
drivers/vhost/vhost.c:900:42: sparse: expected void [noderef] <asn:1> *addr
drivers/vhost/vhost.c:900:42: sparse: got void *addr
drivers/vhost/vhost.c:753:17: sparse: sparse: incorrect type in return expression (different address spaces) @@ expected void [noderef] <asn:1> * @@ got void * @@
drivers/vhost/vhost.c:753:17: sparse: expected void [noderef] <asn:1> *
drivers/vhost/vhost.c:753:17: sparse: got void *
drivers/vhost/vhost.c:922:16: sparse: sparse: restricted __virtio16 degrades to integer
drivers/vhost/vhost.c:922:16: sparse: sparse: restricted __virtio16 degrades to integer
drivers/vhost/vhost.c:922:16: sparse: sparse: cast from restricted __virtio16
drivers/vhost/vhost.c:922:16: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void *addr @@ got restricted __virtio16 [noderef] [usertype] <asn:1> * @@
drivers/vhost/vhost.c:922:16: sparse: expected void *addr
drivers/vhost/vhost.c:922:16: sparse: got restricted __virtio16 [noderef] [usertype] <asn:1> *
drivers/vhost/vhost.c:922:16: sparse: sparse: restricted __virtio16 degrades to integer
drivers/vhost/vhost.c:922:16: sparse: sparse: restricted __virtio16 degrades to integer
drivers/vhost/vhost.c:922:16: sparse: sparse: cast from restricted __virtio16
drivers/vhost/vhost.c:900:42: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void [noderef] <asn:1> *addr @@ got void *addr @@
drivers/vhost/vhost.c:900:42: sparse: expected void [noderef] <asn:1> *addr
drivers/vhost/vhost.c:900:42: sparse: got void *addr
drivers/vhost/vhost.c:753:17: sparse: sparse: incorrect type in return expression (different address spaces) @@ expected void [noderef] <asn:1> * @@ got void * @@
drivers/vhost/vhost.c:753:17: sparse: expected void [noderef] <asn:1> *
drivers/vhost/vhost.c:753:17: sparse: got void *
drivers/vhost/vhost.c:1014:16: sparse: sparse: restricted __virtio16 degrades to integer
drivers/vhost/vhost.c:1014:16: sparse: sparse: restricted __virtio16 degrades to integer
drivers/vhost/vhost.c:1014:16: sparse: sparse: cast to restricted __virtio16
drivers/vhost/vhost.c:1014:16: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void *addr @@ got restricted __virtio16 [noderef] <asn:1> * @@
drivers/vhost/vhost.c:1014:16: sparse: expected void *addr
drivers/vhost/vhost.c:1014:16: sparse: got restricted __virtio16 [noderef] <asn:1> *
drivers/vhost/vhost.c:1014:16: sparse: sparse: restricted __virtio16 degrades to integer
drivers/vhost/vhost.c:1014:16: sparse: sparse: restricted __virtio16 degrades to integer
drivers/vhost/vhost.c:1014:16: sparse: sparse: cast to restricted __virtio16
drivers/vhost/vhost.c:900:42: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void [noderef] <asn:1> *addr @@ got void *addr @@
drivers/vhost/vhost.c:900:42: sparse: expected void [noderef] <asn:1> *addr
drivers/vhost/vhost.c:900:42: sparse: got void *addr
drivers/vhost/vhost.c:753:17: sparse: sparse: incorrect type in return expression (different address spaces) @@ expected void [noderef] <asn:1> * @@ got void * @@
drivers/vhost/vhost.c:753:17: sparse: expected void [noderef] <asn:1> *
drivers/vhost/vhost.c:753:17: sparse: got void *
drivers/vhost/vhost.c:989:16: sparse: sparse: restricted __virtio16 degrades to integer
drivers/vhost/vhost.c:989:16: sparse: sparse: restricted __virtio16 degrades to integer
drivers/vhost/vhost.c:989:16: sparse: sparse: cast to restricted __virtio16
drivers/vhost/vhost.c:989:16: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void *addr @@ got restricted __virtio16 [noderef] <asn:1> * @@
drivers/vhost/vhost.c:989:16: sparse: expected void *addr
drivers/vhost/vhost.c:989:16: sparse: got restricted __virtio16 [noderef] <asn:1> *
drivers/vhost/vhost.c:989:16: sparse: sparse: restricted __virtio16 degrades to integer
drivers/vhost/vhost.c:989:16: sparse: sparse: restricted __virtio16 degrades to integer
drivers/vhost/vhost.c:989:16: sparse: sparse: cast to restricted __virtio16
drivers/vhost/vhost.c:900:42: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void [noderef] <asn:1> *addr @@ got void *addr @@
drivers/vhost/vhost.c:900:42: sparse: expected void [noderef] <asn:1> *addr
drivers/vhost/vhost.c:900:42: sparse: got void *addr
drivers/vhost/vhost.c:753:17: sparse: sparse: incorrect type in return expression (different address spaces) @@ expected void [noderef] <asn:1> * @@ got void * @@
drivers/vhost/vhost.c:753:17: sparse: expected void [noderef] <asn:1> *
drivers/vhost/vhost.c:753:17: sparse: got void *
drivers/vhost/vhost.c:995:16: sparse: sparse: restricted __virtio16 degrades to integer
drivers/vhost/vhost.c:995:16: sparse: sparse: restricted __virtio16 degrades to integer
drivers/vhost/vhost.c:995:16: sparse: sparse: cast to restricted __virtio16
drivers/vhost/vhost.c:995:16: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void *addr @@ got restricted __virtio16 [noderef] <asn:1> * @@
drivers/vhost/vhost.c:995:16: sparse: expected void *addr
drivers/vhost/vhost.c:995:16: sparse: got restricted __virtio16 [noderef] <asn:1> *
drivers/vhost/vhost.c:995:16: sparse: sparse: restricted __virtio16 degrades to integer
drivers/vhost/vhost.c:995:16: sparse: sparse: restricted __virtio16 degrades to integer
drivers/vhost/vhost.c:995:16: sparse: sparse: cast to restricted __virtio16
drivers/vhost/vhost.c:900:42: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void [noderef] <asn:1> *addr @@ got void *addr @@
drivers/vhost/vhost.c:900:42: sparse: expected void [noderef] <asn:1> *addr
drivers/vhost/vhost.c:900:42: sparse: got void *addr
drivers/vhost/vhost.c:753:17: sparse: sparse: incorrect type in return expression (different address spaces) @@ expected void [noderef] <asn:1> * @@ got void * @@
drivers/vhost/vhost.c:753:17: sparse: expected void [noderef] <asn:1> *
drivers/vhost/vhost.c:753:17: sparse: got void *
drivers/vhost/vhost.c:944:16: sparse: sparse: restricted __virtio16 degrades to integer
drivers/vhost/vhost.c:944:16: sparse: sparse: restricted __virtio16 degrades to integer
drivers/vhost/vhost.c:944:16: sparse: sparse: cast from restricted __virtio16
drivers/vhost/vhost.c:944:16: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void *addr @@ got restricted __virtio16 [noderef] <asn:1> * @@
drivers/vhost/vhost.c:944:16: sparse: expected void *addr
drivers/vhost/vhost.c:944:16: sparse: got restricted __virtio16 [noderef] <asn:1> *
drivers/vhost/vhost.c:944:16: sparse: sparse: restricted __virtio16 degrades to integer
drivers/vhost/vhost.c:944:16: sparse: sparse: restricted __virtio16 degrades to integer
drivers/vhost/vhost.c:944:16: sparse: sparse: cast from restricted __virtio16
drivers/vhost/vhost.c:900:42: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void [noderef] <asn:1> *addr @@ got void *addr @@
drivers/vhost/vhost.c:900:42: sparse: expected void [noderef] <asn:1> *addr
drivers/vhost/vhost.c:900:42: sparse: got void *addr
drivers/vhost/vhost.c:753:17: sparse: sparse: incorrect type in return expression (different address spaces) @@ expected void [noderef] <asn:1> * @@ got void * @@
drivers/vhost/vhost.c:753:17: sparse: expected void [noderef] <asn:1> *
drivers/vhost/vhost.c:753:17: sparse: got void *
drivers/vhost/vhost.c:1002:16: sparse: sparse: restricted __virtio16 degrades to integer
drivers/vhost/vhost.c:1002:16: sparse: sparse: restricted __virtio16 degrades to integer
drivers/vhost/vhost.c:1002:16: sparse: sparse: cast to restricted __virtio16
drivers/vhost/vhost.c:1002:16: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void *addr @@ got restricted __virtio16 [noderef] <asn:1> * @@
drivers/vhost/vhost.c:1002:16: sparse: expected void *addr
drivers/vhost/vhost.c:1002:16: sparse: got restricted __virtio16 [noderef] <asn:1> *
drivers/vhost/vhost.c:1002:16: sparse: sparse: restricted __virtio16 degrades to integer
drivers/vhost/vhost.c:1002:16: sparse: sparse: restricted __virtio16 degrades to integer
drivers/vhost/vhost.c:1002:16: sparse: sparse: cast to restricted __virtio16
drivers/vhost/vhost.c:900:42: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void [noderef] <asn:1> *addr @@ got void *addr @@
drivers/vhost/vhost.c:900:42: sparse: expected void [noderef] <asn:1> *addr
drivers/vhost/vhost.c:900:42: sparse: got void *addr
drivers/vhost/vhost.c:753:17: sparse: sparse: incorrect type in return expression (different address spaces) @@ expected void [noderef] <asn:1> * @@ got void * @@
drivers/vhost/vhost.c:753:17: sparse: expected void [noderef] <asn:1> *
drivers/vhost/vhost.c:753:17: sparse: got void *
drivers/vhost/vhost.c:1008:16: sparse: sparse: restricted __virtio16 degrades to integer
drivers/vhost/vhost.c:1008:16: sparse: sparse: restricted __virtio16 degrades to integer
drivers/vhost/vhost.c:1008:16: sparse: sparse: cast to restricted __virtio16

vim +937 drivers/vhost/vhost.c

7b5d753ebc22c5 Jason Wang 2019-05-24 935
7b5d753ebc22c5 Jason Wang 2019-05-24 936 {
7b5d753ebc22c5 Jason Wang 2019-05-24 @937 return vhost_put_user(vq, cpu_to_vhost16(vq, vq->used_flags),
7b5d753ebc22c5 Jason Wang 2019-05-24 938 &vq->used->flags);
7b5d753ebc22c5 Jason Wang 2019-05-24 939 }
7b5d753ebc22c5 Jason Wang 2019-05-24 940

:::::: The code at line 937 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