[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202206302140.XlWYhlXa-lkp@intel.com>
Date: Thu, 30 Jun 2022 21:40:01 +0800
From: kernel test robot <lkp@...el.com>
To: Yishai Hadas <yishaih@...dia.com>, alex.williamson@...hat.com,
jgg@...dia.com
Cc: kbuild-all@...ts.01.org, saeedm@...dia.com, kvm@...r.kernel.org,
netdev@...r.kernel.org, kuba@...nel.org, kevin.tian@...el.com,
joao.m.martins@...cle.com, leonro@...dia.com, yishaih@...dia.com,
maorg@...dia.com, cohuck@...hat.com
Subject: Re: [PATCH vfio 08/13] vfio: Introduce the DMA logging feature
support
Hi Yishai,
I love your patch! Perhaps something to improve:
[auto build test WARNING on awilliam-vfio/next]
[also build test WARNING on linus/master v5.19-rc4 next-20220630]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/intel-lab-lkp/linux/commits/Yishai-Hadas/Add-device-DMA-logging-support-for-mlx5-driver/20220630-182957
base: https://github.com/awilliam/linux-vfio.git next
config: i386-randconfig-a003 (https://download.01.org/0day-ci/archive/20220630/202206302140.XlWYhlXa-lkp@intel.com/config)
compiler: gcc-11 (Debian 11.3.0-3) 11.3.0
reproduce (this is a W=1 build):
# https://github.com/intel-lab-lkp/linux/commit/fea20efca2795fd8480cb0755c54062bad2ea322
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Yishai-Hadas/Add-device-DMA-logging-support-for-mlx5-driver/20220630-182957
git checkout fea20efca2795fd8480cb0755c54062bad2ea322
# save the config file
mkdir build_dir && cp config build_dir/.config
make W=1 O=build_dir ARCH=i386 SHELL=/bin/bash drivers/vfio/
If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@...el.com>
All warnings (new ones prefixed by >>):
drivers/vfio/vfio_main.c: In function 'vfio_ioctl_device_feature_logging_start':
>> drivers/vfio/vfio_main.c:1640:18: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
1640 | ranges = (struct vfio_device_feature_dma_logging_range __user *)
| ^
drivers/vfio/vfio_main.c: In function 'vfio_ioctl_device_feature_logging_report':
drivers/vfio/vfio_main.c:1730:37: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
1730 | (unsigned long __user *)report.bitmap);
| ^
vim +1640 drivers/vfio/vfio_main.c
1607
1608 static int
1609 vfio_ioctl_device_feature_logging_start(struct vfio_device *device,
1610 u32 flags, void __user *arg,
1611 size_t argsz)
1612 {
1613 size_t minsz =
1614 offsetofend(struct vfio_device_feature_dma_logging_control,
1615 ranges);
1616 struct vfio_device_feature_dma_logging_range __user *ranges;
1617 struct vfio_device_feature_dma_logging_control control;
1618 struct vfio_device_feature_dma_logging_range range;
1619 struct rb_root_cached root = RB_ROOT_CACHED;
1620 struct interval_tree_node *nodes;
1621 u32 nnodes;
1622 int i, ret;
1623
1624 if (!device->log_ops)
1625 return -ENOTTY;
1626
1627 ret = vfio_check_feature(flags, argsz,
1628 VFIO_DEVICE_FEATURE_SET,
1629 sizeof(control));
1630 if (ret != 1)
1631 return ret;
1632
1633 if (copy_from_user(&control, arg, minsz))
1634 return -EFAULT;
1635
1636 nnodes = control.num_ranges;
1637 if (!nnodes || nnodes > LOG_MAX_RANGES)
1638 return -EINVAL;
1639
> 1640 ranges = (struct vfio_device_feature_dma_logging_range __user *)
1641 control.ranges;
1642 nodes = kmalloc_array(nnodes, sizeof(struct interval_tree_node),
1643 GFP_KERNEL);
1644 if (!nodes)
1645 return -ENOMEM;
1646
1647 for (i = 0; i < nnodes; i++) {
1648 if (copy_from_user(&range, &ranges[i], sizeof(range))) {
1649 ret = -EFAULT;
1650 goto end;
1651 }
1652 if (!IS_ALIGNED(range.iova, control.page_size) ||
1653 !IS_ALIGNED(range.length, control.page_size)) {
1654 ret = -EINVAL;
1655 goto end;
1656 }
1657 nodes[i].start = range.iova;
1658 nodes[i].last = range.iova + range.length - 1;
1659 if (interval_tree_iter_first(&root, nodes[i].start,
1660 nodes[i].last)) {
1661 /* Range overlapping */
1662 ret = -EINVAL;
1663 goto end;
1664 }
1665 interval_tree_insert(nodes + i, &root);
1666 }
1667
1668 ret = device->log_ops->log_start(device, &root, nnodes,
1669 &control.page_size);
1670 if (ret)
1671 goto end;
1672
1673 if (copy_to_user(arg, &control, sizeof(control))) {
1674 ret = -EFAULT;
1675 device->log_ops->log_stop(device);
1676 }
1677
1678 end:
1679 kfree(nodes);
1680 return ret;
1681 }
1682
--
0-DAY CI Kernel Test Service
https://01.org/lkp
Powered by blists - more mailing lists