Skip to contentSkip to conversation

virtio-pmem: fix virtio_pmem_resp assign problem

PATCH In review [email protected] 4 participants 4 messages Mar 17, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 virtio-pmem: fix virtio_pmem_resp assign problem

From: Wang Liang <[email protected]>

ret in virtio_pmem_resp is a uint32_t variable, which should be assigned using virtio_stl_p.

The kernel side driver does not guarantee virtio_pmem_resp to be initialized to zero in advance, So sometimes the flush operation will fail.

---
 hw/virtio/virtio-pmem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/virtio/virtio-pmem.c +1 -1
index a3e0688a89..d1aeb90a31 100644
@@ -47,7 +47,7 @@ static int worker_cb(void *opaque)
         err = 1;
     }
 
-    virtio_stw_p(req_data->vdev, &req_data->resp.ret, err);
+    virtio_stl_p(req_data->vdev, &req_data->resp.ret, err);
 
     return 0;
 }
Signature · 1 line
2.27.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · On Tue, Mar 16, 2021 at 10:41:45PM -0400, [email protected] wrote:

From: Wang Liang <[email protected]>

ret in virtio_pmem_resp is a uint32_t variable, which should be assigned using virtio_stl_p.

Quoted 7 lines

The kernel side driver does not guarantee virtio_pmem_resp to be initialized to zero in advance, So sometimes the flush operation will fail.

---
hw/virtio/virtio-pmem.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by on v1 1/1
#2 lore raw
In reply to [email protected]
Quoted 19 lines · On 17.03.21 03:41, [email protected] wrote:

From: Wang Liang <[email protected]>

ret in virtio_pmem_resp is a uint32_t variable, which should be assigned using virtio_stl_p.

The kernel side driver does not guarantee virtio_pmem_resp to be initialized to zero in advance, So sometimes the flush operation will fail.

---
  hw/virtio/virtio-pmem.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
hw/virtio/virtio-pmem.c +0 -0
index a3e0688a89..d1aeb90a31 100644

hw/virtio/virtio-pmem.c static int worker_cb(void *opaque) · line 53

Quoted 8 lines
hw/virtio/virtio-pmem.c +1 -1
@@ -47,7 +47,7 @@ static int worker_cb(void *opaque)
          err = 1;
      }
 
-    virtio_stw_p(req_data->vdev, &req_data->resp.ret, err);
+    virtio_stl_p(req_data->vdev, &req_data->resp.ret, err);
 
      return 0;
  }
Signature · 3 lines
Thanks,

David / dhildenb
Reviewed-by on v1 1/1
#3 lore raw
In reply to [email protected]
Quoted 16 lines

ret in virtio_pmem_resp is a uint32_t variable, which should be assigned using virtio_stl_p.

The kernel side driver does not guarantee virtio_pmem_resp to be initialized to zero in advance, So sometimes the flush operation will fail.

---
 hw/virtio/virtio-pmem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/virtio/virtio-pmem.c +0 -0
index a3e0688a89..d1aeb90a31 100644

hw/virtio/virtio-pmem.c static int worker_cb(void *opaque) · line 53

Quoted 8 lines
hw/virtio/virtio-pmem.c +1 -1
@@ -47,7 +47,7 @@ static int worker_cb(void *opaque)
         err = 1;
     }
 
-    virtio_stw_p(req_data->vdev, &req_data->resp.ret, err);
+    virtio_stl_p(req_data->vdev, &req_data->resp.ret, err);
 
     return 0;
 }

Thanks!