218e99
From 2fb2657213334c34748f1353767654208f76ef94 Mon Sep 17 00:00:00 2001
218e99
From: Orit Wasserman <owasserm@redhat.com>
218e99
Date: Wed, 9 Oct 2013 10:09:14 +0200
218e99
Subject: [PATCH 19/25] migration: don't use uninitialized variables
218e99
218e99
RH-Author: Orit Wasserman <owasserm@redhat.com>
218e99
Message-id: <1381313355-15641-10-git-send-email-owasserm@redhat.com>
218e99
Patchwork-id: 54805
218e99
O-Subject: [RHEL7.0 qemu-kvm v2 09/10] migration: don't use uninitialized variables
218e99
Bugzilla: 921465
218e99
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
218e99
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
218e99
RH-Acked-by: Juan Quintela <quintela@redhat.com>
218e99
218e99
From: Pawit Pornkitprasan <p.pawit@gmail.com>
218e99
218e99
The qmp_migrate method uses the 'blk' and 'inc' parameter without
218e99
checking if they're valid or not (they may be uninitialized if
218e99
command is received via QMP)
218e99
218e99
Signed-off-by: Pawit Pornkitprasan <p.pawit@gmail.com>
218e99
Reviewed-by: Eric Blake <eblake@redhat.com>
218e99
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
218e99
(cherry picked from commit 8c0426aed1d2279845e6a2c3355da8b5d9926cb6)
218e99
---
218e99
 migration.c | 4 ++--
218e99
 1 file changed, 2 insertions(+), 2 deletions(-)
218e99
218e99
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
218e99
---
218e99
 migration.c |    4 ++--
218e99
 1 files changed, 2 insertions(+), 2 deletions(-)
218e99
218e99
diff --git a/migration.c b/migration.c
218e99
index d69ac97..6b87272 100644
218e99
--- a/migration.c
218e99
+++ b/migration.c
218e99
@@ -385,8 +385,8 @@ void qmp_migrate(const char *uri, bool has_blk, bool blk,
218e99
     MigrationParams params;
218e99
     const char *p;
218e99
 
218e99
-    params.blk = blk;
218e99
-    params.shared = inc;
218e99
+    params.blk = has_blk && blk;
218e99
+    params.shared = has_inc && inc;
218e99
 
218e99
     if (s->state == MIG_STATE_ACTIVE) {
218e99
         error_set(errp, QERR_MIGRATION_ACTIVE);
218e99
-- 
218e99
1.7.1
218e99