Blob Blame Raw
From a1b552f36a3257593125f054a83c467915c65dc4 Mon Sep 17 00:00:00 2001
From: "Dr. David Alan Gilbert (git)" <dgilbert@redhat.com>
Date: Tue, 14 Jan 2014 15:27:11 -0500
Subject: [PATCH 02/14] The calculation of bytes_xfer in qemu_put_buffer() is
 wrong

Message-id: <1389713232-30999-2-git-send-email-dgilbert@redhat.com>
Patchwork-id: 56697
O-Subject: [RHEL-7.0 qemu-kvm PATCH 1/2] The calculation of bytes_xfer in qemu_put_buffer() is wrong
Bugzilla: 1003467
RH-Acked-by: Orit Wasserman <owasserm@redhat.com>
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>

From: "Wangting (Kathy)" <kathy.wangting@huawei.com>

In qemu_put_buffer(), bytes_xfer += size is wrong, it will be more
than expected, and should be bytes_xfer += l.

Signed-off-by: zhangmin <zhangmin6@huawei.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
(cherry picked from commit 8e86729a0e83b557c22808a2337252c969ca3986)
---
 savevm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
---
 savevm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/savevm.c b/savevm.c
index a0d4e09..bd37959 100644
--- a/savevm.c
+++ b/savevm.c
@@ -787,7 +787,7 @@ void qemu_put_buffer(QEMUFile *f, const uint8_t *buf, int size)
         if (l > size)
             l = size;
         memcpy(f->buf + f->buf_index, buf, l);
-        f->bytes_xfer += size;
+        f->bytes_xfer += l;
         if (f->ops->writev_buffer) {
             add_to_iovec(f, f->buf + f->buf_index, l);
         }
-- 
1.8.3.1