Blob Blame History Raw
From 2fb2657213334c34748f1353767654208f76ef94 Mon Sep 17 00:00:00 2001
From: Orit Wasserman <owasserm@redhat.com>
Date: Wed, 9 Oct 2013 10:09:14 +0200
Subject: [PATCH 19/25] migration: don't use uninitialized variables

RH-Author: Orit Wasserman <owasserm@redhat.com>
Message-id: <1381313355-15641-10-git-send-email-owasserm@redhat.com>
Patchwork-id: 54805
O-Subject: [RHEL7.0 qemu-kvm v2 09/10] migration: don't use uninitialized variables
Bugzilla: 921465
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
RH-Acked-by: Juan Quintela <quintela@redhat.com>

From: Pawit Pornkitprasan <p.pawit@gmail.com>

The qmp_migrate method uses the 'blk' and 'inc' parameter without
checking if they're valid or not (they may be uninitialized if
command is received via QMP)

Signed-off-by: Pawit Pornkitprasan <p.pawit@gmail.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
(cherry picked from commit 8c0426aed1d2279845e6a2c3355da8b5d9926cb6)
---
 migration.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
---
 migration.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/migration.c b/migration.c
index d69ac97..6b87272 100644
--- a/migration.c
+++ b/migration.c
@@ -385,8 +385,8 @@ void qmp_migrate(const char *uri, bool has_blk, bool blk,
     MigrationParams params;
     const char *p;
 
-    params.blk = blk;
-    params.shared = inc;
+    params.blk = has_blk && blk;
+    params.shared = has_inc && inc;
 
     if (s->state == MIG_STATE_ACTIVE) {
         error_set(errp, QERR_MIGRATION_ACTIVE);
-- 
1.7.1