migration: don't use uninitialized variables

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>
This commit is contained in:
Pawit Pornkitprasan 2013-07-30 08:39:52 +09:00 committed by Luiz Capitulino
parent 00c14997cb
commit 8c0426aed1

View File

@ -400,8 +400,8 @@ void qmp_migrate(const char *uri, bool has_blk, bool blk,
MigrationParams params; MigrationParams params;
const char *p; const char *p;
params.blk = blk; params.blk = has_blk && blk;
params.shared = inc; params.shared = has_inc && inc;
if (s->state == MIG_STATE_ACTIVE || s->state == MIG_STATE_SETUP) { if (s->state == MIG_STATE_ACTIVE || s->state == MIG_STATE_SETUP) {
error_set(errp, QERR_MIGRATION_ACTIVE); error_set(errp, QERR_MIGRATION_ACTIVE);