On 13.02.26 13:06, Alexandr Moshkov wrote:
While I was rebasing my series about inflight migration, I missed a
small issue in vhost_inflight_buffer_preload in

3a80ff0 ("vhost: add vmstate for inflight region with inner buffer")

* return wrong type in function
* missed ERRP_GUARD

so fixed it in this patch.

Signed-off-by: Alexandr Moshkov <[email protected]>
---
  hw/virtio/vhost.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
index 52801c1796..56eb1c4a02 100644
--- a/hw/virtio/vhost.c
+++ b/hw/virtio/vhost.c
@@ -1920,6 +1920,7 @@ void vhost_get_features_ex(struct vhost_dev *hdev,
static bool vhost_inflight_buffer_pre_load(void *opaque, Error **errp)
  {
+    ERRP_GUARD();
      struct vhost_inflight *inflight = opaque;
int fd = -1;
@@ -1927,7 +1928,7 @@ static bool vhost_inflight_buffer_pre_load(void *opaque, 
Error **errp)
                                    F_SEAL_GROW | F_SEAL_SHRINK | F_SEAL_SEAL,
                                    &fd, errp);
      if (*errp) {
-        return -ENOMEM;
+        return false;
      }


Instead of ERRP_GUARD, it's better just not dereference errp. We may check for 
addr instead:

if (!addr) {
   return false;
}

inflight->offset = 0;


--
Best regards,
Vladimir

Reply via email to