Re: [PATCH v6 2/4] vfio: VFIO driver for mediated PCI device
From: kbuild test robot <hidden>
Date: 2016-08-03 21:05:03
Also in:
qemu-devel
Hi Kirti, [auto build test WARNING on vfio/next] [also build test WARNING on v4.7 next-20160803] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/Kirti-Wankhede/Add-Mediated-device-support/20160804-032209 base: https://github.com/awilliam/linux-vfio.git next config: i386-allmodconfig (attached as .config) compiler: gcc-6 (Debian 6.1.1-9) 6.1.1 20160705 reproduce: # save the attached .config to linux build tree make ARCH=i386 All warnings (new ones prefixed by >>): drivers/vfio/mdev/vfio_mpci.c: In function 'mdev_dev_mmio_fault':
quoted
drivers/vfio/mdev/vfio_mpci.c:384:17: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
u64 virtaddr = (u64)vmf->virtual_address;
^
In file included from drivers/vfio/mdev/vfio_mpci.c:19:0:quoted
include/linux/vfio.h:23:46: warning: right shift count >= width of type [-Wshift-count-overflow]
#define VFIO_PCI_OFFSET_TO_INDEX(off) (off >> VFIO_PCI_OFFSET_SHIFT)
^quoted
drivers/vfio/mdev/vfio_mpci.c:424:11: note: in expansion of macro 'VFIO_PCI_OFFSET_TO_INDEX'
index = VFIO_PCI_OFFSET_TO_INDEX(vma->vm_pgoff << PAGE_SHIFT);
^~~~~~~~~~~~~~~~~~~~~~~~
vim +384 drivers/vfio/mdev/vfio_mpci.c
378 static int mdev_dev_mmio_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
379 {
380 int ret;
381 struct vfio_mdev *vmdev = vma->vm_private_data;
382 struct mdev_device *mdev;
383 struct parent_device *parent;
> 384 u64 virtaddr = (u64)vmf->virtual_address;
385 unsigned long req_size, pgoff = 0;
386 pgprot_t pg_prot;
387 unsigned int index;
388
389 if (!vmdev && !vmdev->mdev)
390 return -EINVAL;
391
392 mdev = vmdev->mdev;
393 parent = mdev->parent;
394
395 pg_prot = vma->vm_page_prot;
396
397 if (parent->ops->validate_map_request) {
398 u64 offset;
399 loff_t pos;
400
401 offset = virtaddr - vma->vm_start;
402 req_size = vma->vm_end - virtaddr;
403 pos = (vma->vm_pgoff << PAGE_SHIFT) + offset;
404
405 ret = parent->ops->validate_map_request(mdev, pos, &virtaddr,
406 &pgoff, &req_size, &pg_prot);
407 if (ret)
408 return ret;
409
410 /*
411 * Verify pgoff and req_size are valid and virtaddr is within
412 * vma range
413 */
414 if (!pgoff || !req_size || (virtaddr < vma->vm_start) ||
415 ((virtaddr + req_size) >= vma->vm_end))
416 return -EINVAL;
417 } else {
418 struct pci_dev *pdev;
419
420 virtaddr = vma->vm_start;
421 req_size = vma->vm_end - vma->vm_start;
422
423 pdev = to_pci_dev(parent->dev);
> 424 index = VFIO_PCI_OFFSET_TO_INDEX(vma->vm_pgoff << PAGE_SHIFT);
425 pgoff = pci_resource_start(pdev, index) >> PAGE_SHIFT;
426 }
427
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation Attachments
- .config.gz [application/octet-stream] 55108 bytes