From 2fb2657213334c34748f1353767654208f76ef94 Mon Sep 17 00:00:00 2001 From: Orit Wasserman Date: Wed, 9 Oct 2013 10:09:14 +0200 Subject: [PATCH 19/25] migration: don't use uninitialized variables RH-Author: Orit Wasserman 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 RH-Acked-by: Stefan Hajnoczi RH-Acked-by: Juan Quintela From: Pawit Pornkitprasan 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 Reviewed-by: Eric Blake Signed-off-by: Luiz Capitulino (cherry picked from commit 8c0426aed1d2279845e6a2c3355da8b5d9926cb6) --- migration.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) Signed-off-by: Miroslav Rezanina --- 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