[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20201029145649.GA26151@xsang-OptiPlex-9020>
Date: Thu, 29 Oct 2020 22:56:49 +0800
From: kernel test robot <lkp@...el.com>
To: Tiwei Bie <tiwei.bie@...el.com>
Cc: kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org,
"Michael S. Tsirkin" <mst@...hat.com>,
Eugenio PĂ©rez <eperezma@...hat.com>,
Jason Wang <jasowang@...hat.com>
Subject: drivers/vhost/vdpa.c:303:13: sparse: expected unsigned int const
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: ed8780e3f2ecc82645342d070c6b4e530532e680
commit: 4c8cf31885f69e86be0b5b9e6677a26797365e1d vhost: introduce vDPA-based backend
date: 7 months ago
:::::: branch date: 17 hours ago
:::::: commit date: 7 months ago
config: sh-randconfig-s031-20201028 (attached as .config)
compiler: sh4-linux-gcc (GCC) 9.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-56-gc09e8239-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=4c8cf31885f69e86be0b5b9e6677a26797365e1d
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 4c8cf31885f69e86be0b5b9e6677a26797365e1d
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=sh
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>
"sparse warnings: (new ones prefixed by >>)"
drivers/vhost/vdpa.c: note: in included file (through arch/sh/include/asm/unistd.h, include/uapi/linux/unistd.h, include/linux/compat.h, ...):
./arch/sh/include/generated/uapi/asm/unistd_32.h:411:37: sparse: sparse: no newline at end of file
drivers/vhost/vdpa.c:303:13: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected unsigned int const *__gu_addr @@ got unsigned int [noderef] [usertype] <asn:1> * @@
>> drivers/vhost/vdpa.c:303:13: sparse: expected unsigned int const *__gu_addr
drivers/vhost/vdpa.c:303:13: sparse: got unsigned int [noderef] [usertype] <asn:1> *
drivers/vhost/vdpa.c:303:13: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] <asn:1> * @@ got unsigned int const *__gu_addr @@
drivers/vhost/vdpa.c:303:13: sparse: expected void const volatile [noderef] <asn:1> *
>> drivers/vhost/vdpa.c:303:13: sparse: got unsigned int const *__gu_addr
vim +303 drivers/vhost/vdpa.c
4c8cf31885f69e8 Tiwei Bie 2020-03-26 290
4c8cf31885f69e8 Tiwei Bie 2020-03-26 291 static long vhost_vdpa_vring_ioctl(struct vhost_vdpa *v, unsigned int cmd,
4c8cf31885f69e8 Tiwei Bie 2020-03-26 292 void __user *argp)
4c8cf31885f69e8 Tiwei Bie 2020-03-26 293 {
4c8cf31885f69e8 Tiwei Bie 2020-03-26 294 struct vdpa_device *vdpa = v->vdpa;
4c8cf31885f69e8 Tiwei Bie 2020-03-26 295 const struct vdpa_config_ops *ops = vdpa->config;
4c8cf31885f69e8 Tiwei Bie 2020-03-26 296 struct vdpa_callback cb;
4c8cf31885f69e8 Tiwei Bie 2020-03-26 297 struct vhost_virtqueue *vq;
4c8cf31885f69e8 Tiwei Bie 2020-03-26 298 struct vhost_vring_state s;
4c8cf31885f69e8 Tiwei Bie 2020-03-26 299 u8 status;
4c8cf31885f69e8 Tiwei Bie 2020-03-26 300 u32 idx;
4c8cf31885f69e8 Tiwei Bie 2020-03-26 301 long r;
4c8cf31885f69e8 Tiwei Bie 2020-03-26 302
4c8cf31885f69e8 Tiwei Bie 2020-03-26 @303 r = get_user(idx, (u32 __user *)argp);
4c8cf31885f69e8 Tiwei Bie 2020-03-26 304 if (r < 0)
4c8cf31885f69e8 Tiwei Bie 2020-03-26 305 return r;
4c8cf31885f69e8 Tiwei Bie 2020-03-26 306
4c8cf31885f69e8 Tiwei Bie 2020-03-26 307 if (idx >= v->nvqs)
4c8cf31885f69e8 Tiwei Bie 2020-03-26 308 return -ENOBUFS;
4c8cf31885f69e8 Tiwei Bie 2020-03-26 309
4c8cf31885f69e8 Tiwei Bie 2020-03-26 310 idx = array_index_nospec(idx, v->nvqs);
4c8cf31885f69e8 Tiwei Bie 2020-03-26 311 vq = &v->vqs[idx];
4c8cf31885f69e8 Tiwei Bie 2020-03-26 312
4c8cf31885f69e8 Tiwei Bie 2020-03-26 313 status = ops->get_status(vdpa);
4c8cf31885f69e8 Tiwei Bie 2020-03-26 314
4c8cf31885f69e8 Tiwei Bie 2020-03-26 315 if (cmd == VHOST_VDPA_SET_VRING_ENABLE) {
4c8cf31885f69e8 Tiwei Bie 2020-03-26 316 if (copy_from_user(&s, argp, sizeof(s)))
4c8cf31885f69e8 Tiwei Bie 2020-03-26 317 return -EFAULT;
4c8cf31885f69e8 Tiwei Bie 2020-03-26 318 ops->set_vq_ready(vdpa, idx, s.num);
4c8cf31885f69e8 Tiwei Bie 2020-03-26 319 return 0;
4c8cf31885f69e8 Tiwei Bie 2020-03-26 320 }
4c8cf31885f69e8 Tiwei Bie 2020-03-26 321
4c8cf31885f69e8 Tiwei Bie 2020-03-26 322 if (cmd == VHOST_GET_VRING_BASE)
4c8cf31885f69e8 Tiwei Bie 2020-03-26 323 vq->last_avail_idx = ops->get_vq_state(v->vdpa, idx);
4c8cf31885f69e8 Tiwei Bie 2020-03-26 324
4c8cf31885f69e8 Tiwei Bie 2020-03-26 325 r = vhost_vring_ioctl(&v->vdev, cmd, argp);
4c8cf31885f69e8 Tiwei Bie 2020-03-26 326 if (r)
4c8cf31885f69e8 Tiwei Bie 2020-03-26 327 return r;
4c8cf31885f69e8 Tiwei Bie 2020-03-26 328
4c8cf31885f69e8 Tiwei Bie 2020-03-26 329 switch (cmd) {
4c8cf31885f69e8 Tiwei Bie 2020-03-26 330 case VHOST_SET_VRING_ADDR:
4c8cf31885f69e8 Tiwei Bie 2020-03-26 331 if (ops->set_vq_address(vdpa, idx,
4c8cf31885f69e8 Tiwei Bie 2020-03-26 332 (u64)(uintptr_t)vq->desc,
4c8cf31885f69e8 Tiwei Bie 2020-03-26 333 (u64)(uintptr_t)vq->avail,
4c8cf31885f69e8 Tiwei Bie 2020-03-26 334 (u64)(uintptr_t)vq->used))
4c8cf31885f69e8 Tiwei Bie 2020-03-26 335 r = -EINVAL;
4c8cf31885f69e8 Tiwei Bie 2020-03-26 336 break;
4c8cf31885f69e8 Tiwei Bie 2020-03-26 337
4c8cf31885f69e8 Tiwei Bie 2020-03-26 338 case VHOST_SET_VRING_BASE:
4c8cf31885f69e8 Tiwei Bie 2020-03-26 339 if (ops->set_vq_state(vdpa, idx, vq->last_avail_idx))
4c8cf31885f69e8 Tiwei Bie 2020-03-26 340 r = -EINVAL;
4c8cf31885f69e8 Tiwei Bie 2020-03-26 341 break;
4c8cf31885f69e8 Tiwei Bie 2020-03-26 342
4c8cf31885f69e8 Tiwei Bie 2020-03-26 343 case VHOST_SET_VRING_CALL:
4c8cf31885f69e8 Tiwei Bie 2020-03-26 344 if (vq->call_ctx) {
4c8cf31885f69e8 Tiwei Bie 2020-03-26 345 cb.callback = vhost_vdpa_virtqueue_cb;
4c8cf31885f69e8 Tiwei Bie 2020-03-26 346 cb.private = vq;
4c8cf31885f69e8 Tiwei Bie 2020-03-26 347 } else {
4c8cf31885f69e8 Tiwei Bie 2020-03-26 348 cb.callback = NULL;
4c8cf31885f69e8 Tiwei Bie 2020-03-26 349 cb.private = NULL;
4c8cf31885f69e8 Tiwei Bie 2020-03-26 350 }
4c8cf31885f69e8 Tiwei Bie 2020-03-26 351 ops->set_vq_cb(vdpa, idx, &cb);
4c8cf31885f69e8 Tiwei Bie 2020-03-26 352 break;
4c8cf31885f69e8 Tiwei Bie 2020-03-26 353
4c8cf31885f69e8 Tiwei Bie 2020-03-26 354 case VHOST_SET_VRING_NUM:
4c8cf31885f69e8 Tiwei Bie 2020-03-26 355 ops->set_vq_num(vdpa, idx, vq->num);
4c8cf31885f69e8 Tiwei Bie 2020-03-26 356 break;
4c8cf31885f69e8 Tiwei Bie 2020-03-26 357 }
4c8cf31885f69e8 Tiwei Bie 2020-03-26 358
4c8cf31885f69e8 Tiwei Bie 2020-03-26 359 return r;
4c8cf31885f69e8 Tiwei Bie 2020-03-26 360 }
4c8cf31885f69e8 Tiwei Bie 2020-03-26 361
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Download attachment ".config.gz" of type "application/gzip" (23118 bytes)
Powered by blists - more mailing lists