Subject: [PATCH 13/46] rdma: bugfix: ram_control_save_page()

From: Nigel Croxon <[email-masked]>
Date: Thu, 14 Nov 2013 22:52:49 +0100

RH-Author: Nigel Croxon <[email-masked]>
Message-id: <[email-masked]>
Patchwork-id: 55695
O-Subject: [RHEL7.0 PATCH 13/42] rdma: bugfix: ram_control_save_page()
Bugzilla: 1011720
RH-Acked-by: Orit Wasserman <[email-masked]>
RH-Acked-by: Amit Shah <[email-masked]>
RH-Acked-by: Paolo Bonzini <[email-masked]>

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

>From commit ID:
commit de7b685c9e1cf606e37e7116e4c4f03a6ae2d14f
Author: Michael R. Hines <[email-masked]>
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 <[email-masked]>
    Signed-off-by: Michael R. Hines <[email-masked]>
    Signed-off-by: Juan Quintela <[email-masked]>
---
 savevm.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Signed-off-by: Michal Novotny <[email-masked]>
---
 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