Skip to contentSkip to conversation

s390x/vfio-ap: report correct error

PATCH Applied Cornelia Huck 4 participants 5 messages Oct 16, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 s390x/vfio-ap: report correct error

If ioctl(..., VFIO_DEVICE_RESET) fails, we want to report errno instead of ret (which is always -1 on error).

Fixes Coverity issue CID 1396176.

---
 hw/vfio/ap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/vfio/ap.c +1 -1
index 3962bb74e5..65de952f44 100644
@@ -142,7 +142,7 @@ static void vfio_ap_reset(DeviceState *dev)
     ret = ioctl(vapdev->vdev.fd, VFIO_DEVICE_RESET);
     if (ret) {
         error_report("%s: failed to reset %s device: %s", __func__,
-                     vapdev->vdev.name, strerror(ret));
+                     vapdev->vdev.name, strerror(errno));
     }
 }
 
Signature · 1 line
2.14.4
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Cornelia Huck

If ioctl(..., VFIO_DEVICE_RESET) fails, we want to report errno instead of ret (which is always -1 on error).

Fixes Coverity issue CID 1396176.

makes sense

Quoted 18 lines
---
 hw/vfio/ap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/vfio/ap.c +1 -1
index 3962bb74e5..65de952f44 100644
@@ -142,7 +142,7 @@ static void vfio_ap_reset(DeviceState *dev)
     ret = ioctl(vapdev->vdev.fd, VFIO_DEVICE_RESET);
     if (ret) {
         error_report("%s: failed to reset %s device: %s", __func__,
-                     vapdev->vdev.name, strerror(ret));
+                     vapdev->vdev.name, strerror(errno));
     }
 }
 
Reviewed-by on v1 1/1
#2 lore raw
In reply to Cornelia Huck
Quoted 17 lines · Cornelia Huck

If ioctl(..., VFIO_DEVICE_RESET) fails, we want to report errno instead of ret (which is always -1 on error).

Fixes Coverity issue CID 1396176.

---
 hw/vfio/ap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/vfio/ap.c +0 -0
index 3962bb74e5..65de952f44 100644

hw/vfio/ap.c static void vfio_ap_reset(DeviceState *dev) · line 148

Quoted 8 lines
hw/vfio/ap.c +1 -1
@@ -142,7 +142,7 @@ static void vfio_ap_reset(DeviceState *dev)
     ret = ioctl(vapdev->vdev.fd, VFIO_DEVICE_RESET);
     if (ret) {
         error_report("%s: failed to reset %s device: %s", __func__,
-                     vapdev->vdev.name, strerror(ret));
+                     vapdev->vdev.name, strerror(errno));
     }
 }
 
Reviewed-by on v1 1/1
#3 lore raw
In reply to Cornelia Huck
Quoted 16 lines · Cornelia Huck

If ioctl(..., VFIO_DEVICE_RESET) fails, we want to report errno instead of ret (which is always -1 on error).

Fixes Coverity issue CID 1396176.

---
  hw/vfio/ap.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
hw/vfio/ap.c +0 -0
index 3962bb74e5..65de952f44 100644

hw/vfio/ap.c static void vfio_ap_reset(DeviceState *dev) · line 147

Quoted 7 lines
hw/vfio/ap.c +1 -1
@@ -142,7 +142,7 @@ static void vfio_ap_reset(DeviceState *dev)
      ret = ioctl(vapdev->vdev.fd, VFIO_DEVICE_RESET);
      if (ret) {
          error_report("%s: failed to reset %s device: %s", __func__,
-                     vapdev->vdev.name, strerror(ret));
+                     vapdev->vdev.name, strerror(errno));
      }
  }
Quoted 2 lines
author Applied
#4 lore raw
In reply to Cornelia Huck
Quoted 10 lines · On Tue, 16 Oct 2018 13:58:17 +0200 Cornelia Huck <[email protected]> wrote:

If ioctl(..., VFIO_DEVICE_RESET) fails, we want to report errno instead of ret (which is always -1 on error).

Fixes Coverity issue CID 1396176.

---
 hw/vfio/ap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Queued to s390-next.