Blob Blame Raw
From e5cb4139f938fd2f8e6910f92b15173083a3a517 Mon Sep 17 00:00:00 2001
Message-Id: <e5cb4139f938fd2f8e6910f92b15173083a3a517.1387382496.git.minovotn@redhat.com>
In-Reply-To: <c5386144fbf09f628148101bc674e2421cdd16e3.1387382496.git.minovotn@redhat.com>
References: <c5386144fbf09f628148101bc674e2421cdd16e3.1387382496.git.minovotn@redhat.com>
From: Nigel Croxon <ncroxon@redhat.com>
Date: Thu, 14 Nov 2013 22:52:49 +0100
Subject: [PATCH 13/46] rdma: bugfix: ram_control_save_page()

RH-Author: Nigel Croxon <ncroxon@redhat.com>
Message-id: <1384469598-13137-14-git-send-email-ncroxon@redhat.com>
Patchwork-id: 55695
O-Subject: [RHEL7.0 PATCH 13/42] rdma: bugfix: ram_control_save_page()
Bugzilla: 1011720
RH-Acked-by: Orit Wasserman <owasserm@redhat.com>
RH-Acked-by: Amit Shah <amit.shah@redhat.com>
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>

Bugzilla: 1011720
https://bugzilla.redhat.com/show_bug.cgi?id=1011720

>From commit ID:
commit de7b685c9e1cf606e37e7116e4c4f03a6ae2d14f
Author: Michael R. Hines <mrhines@us.ibm.com>
Date:   Mon Jul 22 10:01:52 2013 -0400

    rdma: bugfix: ram_control_save_page()

    We were not checking for a valid 'bytes_sent' pointer before accessing it.

    Reviewed-by: Eric Blake <eblake@redhat.com>
    Signed-off-by: Michael R. Hines <mrhines@us.ibm.com>
    Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 savevm.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

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

diff --git a/savevm.c b/savevm.c
index e0491e7..03fc4d9 100644
--- a/savevm.c
+++ b/savevm.c
@@ -662,7 +662,7 @@ size_t ram_control_save_page(QEMUFile *f, ram_addr_t block_offset,
                                     offset, size, bytes_sent);
 
         if (ret != RAM_SAVE_CONTROL_DELAYED) {
-            if (*bytes_sent > 0) {
+            if (bytes_sent && *bytes_sent > 0) {
                 qemu_update_position(f, *bytes_sent);
             } else if (ret < 0) {
                 qemu_file_set_error(f, ret);
-- 
1.7.11.7