Re: [PATCH] vfio_pci_core: Make vfio_pci_regops->rw() return ssize_t

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 20 Jul 2021 14:39:12 -0300
Jason Gunthorpe <jgg@xxxxxxxxxx> wrote:

> From: Yishai Hadas <yishaih@xxxxxxxxxx>
> 
> The only implementation of this in IGD returns a -ERRNO which is
> implicitly cast through a size_t and then casted again and returned as a
> ssize_t in vfio_pci_rw().
> 
> Fix the vfio_pci_regops->rw() return type to be ssize_t so all is
> consistent.
> 
> Fixes: 28541d41c9e0 ("vfio/pci: Add infrastructure for additional device specific regions")
> Signed-off-by: Yishai Hadas <yishaih@xxxxxxxxxx>
> ---
>  drivers/vfio/pci/vfio_pci_igd.c | 10 +++++-----
>  include/linux/vfio_pci_core.h   |  2 +-
>  2 files changed, 6 insertions(+), 6 deletions(-)


This is against vfio_pci_core code that we don't have upstream yet.
Thanks,

Alex

 
> diff --git a/drivers/vfio/pci/vfio_pci_igd.c b/drivers/vfio/pci/vfio_pci_igd.c
> index f04774cd3a7ff0..8d07f0fc365c21 100644
> --- a/drivers/vfio/pci/vfio_pci_igd.c
> +++ b/drivers/vfio/pci/vfio_pci_igd.c
> @@ -25,8 +25,8 @@
>  #define OPREGION_RVDS		0x3c2
>  #define OPREGION_VERSION	0x16
>  
> -static size_t vfio_pci_igd_rw(struct vfio_pci_core_device *vdev, char __user *buf,
> -			      size_t count, loff_t *ppos, bool iswrite)
> +static ssize_t vfio_pci_igd_rw(struct vfio_pci_core_device *vdev, char __user *buf,
> +			       size_t count, loff_t *ppos, bool iswrite)
>  {
>  	unsigned int i = VFIO_PCI_OFFSET_TO_INDEX(*ppos) - VFIO_PCI_NUM_REGIONS;
>  	void *base = vdev->region[i].data;
> @@ -160,9 +160,9 @@ static int vfio_pci_igd_opregion_init(struct vfio_pci_core_device *vdev)
>  	return ret;
>  }
>  
> -static size_t vfio_pci_igd_cfg_rw(struct vfio_pci_core_device *vdev,
> -				  char __user *buf, size_t count, loff_t *ppos,
> -				  bool iswrite)
> +static ssize_t vfio_pci_igd_cfg_rw(struct vfio_pci_core_device *vdev,
> +				   char __user *buf, size_t count, loff_t *ppos,
> +				   bool iswrite)
>  {
>  	unsigned int i = VFIO_PCI_OFFSET_TO_INDEX(*ppos) - VFIO_PCI_NUM_REGIONS;
>  	struct pci_dev *pdev = vdev->region[i].data;
> diff --git a/include/linux/vfio_pci_core.h b/include/linux/vfio_pci_core.h
> index 0a51836e002e1e..fb5add3bded0ac 100644
> --- a/include/linux/vfio_pci_core.h
> +++ b/include/linux/vfio_pci_core.h
> @@ -57,7 +57,7 @@ struct vfio_pci_core_device;
>  struct vfio_pci_region;
>  
>  struct vfio_pci_regops {
> -	size_t	(*rw)(struct vfio_pci_core_device *vdev, char __user *buf,
> +	ssize_t	(*rw)(struct vfio_pci_core_device *vdev, char __user *buf,
>  		      size_t count, loff_t *ppos, bool iswrite);
>  	void	(*release)(struct vfio_pci_core_device *vdev,
>  			   struct vfio_pci_region *region);




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux