From: Wang Liang Date: Wed, 17 Mar 2021 02:41:45 +0000 (-0400) Subject: virtio-pmem: fix virtio_pmem_resp assign problem X-Git-Tag: v6.0.0-rc0~8^2~11 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d2adda34a9989404a4fc86cb4127a3ea103a7938;p=thirdparty%2Fqemu.git virtio-pmem: fix virtio_pmem_resp assign problem 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. Signed-off-by: Wang Liang Message-Id: <20210317024145.271212-1-wangliangzz@126.com> Reviewed-by: Stefano Garzarella Reviewed-by: David Hildenbrand Reviewed-by: Pankaj Gupta Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- diff --git a/hw/virtio/virtio-pmem.c b/hw/virtio/virtio-pmem.c index a3e0688a891..d1aeb90a31a 100644 --- a/hw/virtio/virtio-pmem.c +++ b/hw/virtio/virtio-pmem.c @@ -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; }