Skip to content

Commit

Permalink
migration: don't use uninitialized variables
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
pawitp authored and Luiz Capitulino committed Aug 1, 2013
1 parent 00c1499 commit 8c0426a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions migration.c
Expand Up @@ -400,8 +400,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 || s->state == MIG_STATE_SETUP) {
error_set(errp, QERR_MIGRATION_ACTIVE);
Expand Down

0 comments on commit 8c0426a

Please sign in to comment.