2021-07-27 03:26:46

by Cai,Huoqing

[permalink] [raw]
Subject: [PATCH] vfio/pci: use "ssize_t" as a return value instead of "size_t"

should use ssize_t when it returns error code and size_t

Signed-off-by: Cai Huoqing <[email protected]>
---
drivers/vfio/pci/vfio_pci_igd.c | 4 ++--
drivers/vfio/pci/vfio_pci_private.h | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/vfio/pci/vfio_pci_igd.c b/drivers/vfio/pci/vfio_pci_igd.c
index 228df565e9bc..3377ba379bfd 100644
--- a/drivers/vfio/pci/vfio_pci_igd.c
+++ b/drivers/vfio/pci/vfio_pci_igd.c
@@ -25,7 +25,7 @@
#define OPREGION_RVDS 0x3c2
#define OPREGION_VERSION 0x16

-static size_t vfio_pci_igd_rw(struct vfio_pci_device *vdev, char __user *buf,
+static ssize_t vfio_pci_igd_rw(struct vfio_pci_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;
@@ -160,7 +160,7 @@ static int vfio_pci_igd_opregion_init(struct vfio_pci_device *vdev)
return ret;
}

-static size_t vfio_pci_igd_cfg_rw(struct vfio_pci_device *vdev,
+static ssize_t vfio_pci_igd_cfg_rw(struct vfio_pci_device *vdev,
char __user *buf, size_t count, loff_t *ppos,
bool iswrite)
{
diff --git a/drivers/vfio/pci/vfio_pci_private.h b/drivers/vfio/pci/vfio_pci_private.h
index 5a36272cecbf..bbc56c857ef0 100644
--- a/drivers/vfio/pci/vfio_pci_private.h
+++ b/drivers/vfio/pci/vfio_pci_private.h
@@ -56,7 +56,7 @@ struct vfio_pci_device;
struct vfio_pci_region;

struct vfio_pci_regops {
- size_t (*rw)(struct vfio_pci_device *vdev, char __user *buf,
+ ssize_t (*rw)(struct vfio_pci_device *vdev, char __user *buf,
size_t count, loff_t *ppos, bool iswrite);
void (*release)(struct vfio_pci_device *vdev,
struct vfio_pci_region *region);
--
2.25.1


2021-07-27 11:57:07

by Jason Gunthorpe

[permalink] [raw]
Subject: Re: [PATCH] vfio/pci: use "ssize_t" as a return value instead of "size_t"

On Tue, Jul 27, 2021 at 11:24:33AM +0800, Cai Huoqing wrote:
> should use ssize_t when it returns error code and size_t
>
> Signed-off-by: Cai Huoqing <[email protected]>
> ---
> drivers/vfio/pci/vfio_pci_igd.c | 4 ++--
> drivers/vfio/pci/vfio_pci_private.h | 2 +-
> 2 files changed, 3 insertions(+), 3 deletions(-)

This is a dup of this patch:

https://lore.kernel.org/kvm/[email protected]/

Jason