* [PATCH v3] vfio/pci: Make vfio_pci_regops->rw() return ssize_t
@ 2021-07-21 13:05 Jason Gunthorpe
2021-07-21 13:56 ` Cornelia Huck
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Jason Gunthorpe @ 2021-07-21 13:05 UTC (permalink / raw)
To: Cornelia Huck, kvm; +Cc: Alex Williamson, Yishai Hadas
From: Yishai Hadas <yishaih@nvidia.com>
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@nvidia.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
---
drivers/vfio/pci/vfio_pci_igd.c | 10 +++++-----
drivers/vfio/pci/vfio_pci_private.h | 2 +-
2 files changed, 6 insertions(+), 6 deletions(-)
v3:
- Fix commit subject and missing signed-off-by
diff --git a/drivers/vfio/pci/vfio_pci_igd.c b/drivers/vfio/pci/vfio_pci_igd.c
index 228df565e9bc40..aa0a29fd276285 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_device *vdev, char __user *buf,
- size_t count, loff_t *ppos, bool iswrite)
+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;
void *base = vdev->region[i].data;
@@ -160,9 +160,9 @@ 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,
- char __user *buf, size_t count, loff_t *ppos,
- bool iswrite)
+static ssize_t vfio_pci_igd_cfg_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;
struct pci_dev *pdev = vdev->region[i].data;
diff --git a/drivers/vfio/pci/vfio_pci_private.h b/drivers/vfio/pci/vfio_pci_private.h
index 5a36272cecbf94..bbc56c857ef081 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.32.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v3] vfio/pci: Make vfio_pci_regops->rw() return ssize_t
2021-07-21 13:05 [PATCH v3] vfio/pci: Make vfio_pci_regops->rw() return ssize_t Jason Gunthorpe
@ 2021-07-21 13:56 ` Cornelia Huck
2021-07-27 12:41 ` Max Gurtovoy
2021-08-03 18:45 ` Alex Williamson
2 siblings, 0 replies; 4+ messages in thread
From: Cornelia Huck @ 2021-07-21 13:56 UTC (permalink / raw)
To: Jason Gunthorpe, kvm; +Cc: Alex Williamson, Yishai Hadas
On Wed, Jul 21 2021, Jason Gunthorpe <jgg@nvidia.com> wrote:
> From: Yishai Hadas <yishaih@nvidia.com>
>
> 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@nvidia.com>
> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
> ---
> drivers/vfio/pci/vfio_pci_igd.c | 10 +++++-----
> drivers/vfio/pci/vfio_pci_private.h | 2 +-
> 2 files changed, 6 insertions(+), 6 deletions(-)
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v3] vfio/pci: Make vfio_pci_regops->rw() return ssize_t
2021-07-21 13:05 [PATCH v3] vfio/pci: Make vfio_pci_regops->rw() return ssize_t Jason Gunthorpe
2021-07-21 13:56 ` Cornelia Huck
@ 2021-07-27 12:41 ` Max Gurtovoy
2021-08-03 18:45 ` Alex Williamson
2 siblings, 0 replies; 4+ messages in thread
From: Max Gurtovoy @ 2021-07-27 12:41 UTC (permalink / raw)
To: Jason Gunthorpe, Cornelia Huck, kvm; +Cc: Alex Williamson, Yishai Hadas
On 7/21/2021 4:05 PM, Jason Gunthorpe wrote:
> From: Yishai Hadas <yishaih@nvidia.com>
>
> 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@nvidia.com>
> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
> ---
> drivers/vfio/pci/vfio_pci_igd.c | 10 +++++-----
> drivers/vfio/pci/vfio_pci_private.h | 2 +-
> 2 files changed, 6 insertions(+), 6 deletions(-)
>
> v3:
> - Fix commit subject and missing signed-off-by
Looks good,
Reviewed-by: Max Gurtovoy <mgurtovoy@nvidia.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v3] vfio/pci: Make vfio_pci_regops->rw() return ssize_t
2021-07-21 13:05 [PATCH v3] vfio/pci: Make vfio_pci_regops->rw() return ssize_t Jason Gunthorpe
2021-07-21 13:56 ` Cornelia Huck
2021-07-27 12:41 ` Max Gurtovoy
@ 2021-08-03 18:45 ` Alex Williamson
2 siblings, 0 replies; 4+ messages in thread
From: Alex Williamson @ 2021-08-03 18:45 UTC (permalink / raw)
To: Jason Gunthorpe; +Cc: Cornelia Huck, kvm, Yishai Hadas
On Wed, 21 Jul 2021 10:05:48 -0300
Jason Gunthorpe <jgg@nvidia.com> wrote:
> From: Yishai Hadas <yishaih@nvidia.com>
>
> 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@nvidia.com>
> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
> ---
> drivers/vfio/pci/vfio_pci_igd.c | 10 +++++-----
> drivers/vfio/pci/vfio_pci_private.h | 2 +-
> 2 files changed, 6 insertions(+), 6 deletions(-)
Applied to vfio next branch for v5.15 with Max and Connie's R-b.
Thanks,
Alex
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-08-03 18:45 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-21 13:05 [PATCH v3] vfio/pci: Make vfio_pci_regops->rw() return ssize_t Jason Gunthorpe
2021-07-21 13:56 ` Cornelia Huck
2021-07-27 12:41 ` Max Gurtovoy
2021-08-03 18:45 ` Alex Williamson
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).