netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Yishai Hadas <yishaih@nvidia.com>,
	alex.williamson@redhat.com, jgg@nvidia.com
Cc: kbuild-all@lists.01.org, saeedm@nvidia.com, kvm@vger.kernel.org,
	netdev@vger.kernel.org, kuba@kernel.org, kevin.tian@intel.com,
	joao.m.martins@oracle.com, leonro@nvidia.com, yishaih@nvidia.com,
	maorg@nvidia.com, cohuck@redhat.com
Subject: Re: [PATCH vfio 08/13] vfio: Introduce the DMA logging feature support
Date: Thu, 30 Jun 2022 21:40:01 +0800	[thread overview]
Message-ID: <202206302140.XlWYhlXa-lkp@intel.com> (raw)
In-Reply-To: <20220630102545.18005-9-yishaih@nvidia.com>

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@intel.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

  reply	other threads:[~2022-06-30 13:41 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-30 10:25 [PATCH vfio 00/13] Add device DMA logging support for mlx5 driver Yishai Hadas
2022-06-30 10:25 ` [PATCH vfio 01/13] vfio/mlx5: Protect mlx5vf_disable_fds() upon close device Yishai Hadas
2022-06-30 10:25 ` [PATCH vfio 02/13] vfio: Split migration ops from main device ops Yishai Hadas
2022-06-30 10:25 ` [PATCH vfio 03/13] net/mlx5: Introduce ifc bits for page tracker Yishai Hadas
2022-06-30 10:25 ` [PATCH vfio 04/13] net/mlx5: Query ADV_VIRTUALIZATION capabilities Yishai Hadas
2022-06-30 10:25 ` [PATCH vfio 05/13] vfio: Introduce DMA logging uAPIs Yishai Hadas
2022-06-30 10:25 ` [PATCH vfio 06/13] vfio: Move vfio.c to vfio_main.c Yishai Hadas
2022-06-30 10:25 ` [PATCH vfio 07/13] vfio: Add an IOVA bitmap support Yishai Hadas
2022-06-30 10:25 ` [PATCH vfio 08/13] vfio: Introduce the DMA logging feature support Yishai Hadas
2022-06-30 13:40   ` kernel test robot [this message]
2022-06-30 13:48     ` Jason Gunthorpe
2022-07-01  4:24   ` kernel test robot
2022-07-01  4:55   ` kernel test robot
2022-06-30 10:25 ` [PATCH vfio 09/13] vfio/mlx5: Init QP based resources for dirty tracking Yishai Hadas
2022-06-30 10:25 ` [PATCH vfio 10/13] vfio/mlx5: Create and destroy page tracker object Yishai Hadas
2022-06-30 10:25 ` [PATCH vfio 11/13] vfio/mlx5: Report dirty pages from tracker Yishai Hadas
2022-06-30 10:25 ` [PATCH vfio 12/13] vfio/mlx5: Manage error scenarios on tracker Yishai Hadas
2022-06-30 10:25 ` [PATCH vfio 13/13] vfio/mlx5: Set the driver DMA logging callbacks Yishai Hadas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202206302140.XlWYhlXa-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=alex.williamson@redhat.com \
    --cc=cohuck@redhat.com \
    --cc=jgg@nvidia.com \
    --cc=joao.m.martins@oracle.com \
    --cc=kbuild-all@lists.01.org \
    --cc=kevin.tian@intel.com \
    --cc=kuba@kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=leonro@nvidia.com \
    --cc=maorg@nvidia.com \
    --cc=netdev@vger.kernel.org \
    --cc=saeedm@nvidia.com \
    --cc=yishaih@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).