qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Pawit Pornkitprasan <p.pawit@gmail.com>
To: qemu-devel@nongnu.org
Cc: Luiz Capitulino <lcapitulino@redhat.com>,
	Pawit Pornkitprasan <p.pawit@gmail.com>,
	Ryousei Takano <takano-ryousei@aist.go.jp>,
	Juan Quintela <quintela@redhat.com>
Subject: [Qemu-devel] [PATCH v2] migration: don't use uninitialized variables
Date: Tue, 30 Jul 2013 08:39:52 +0900	[thread overview]
Message-ID: <1375141192-1121-1-git-send-email-p.pawit@gmail.com> (raw)

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>
---
 migration.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/migration.c b/migration.c
index 9fc7294..57a7998 100644
--- a/migration.c
+++ b/migration.c
@@ -399,8 +399,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);
-- 
1.7.3.4

             reply	other threads:[~2013-07-29 23:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-29 23:39 Pawit Pornkitprasan [this message]
2013-07-30 12:34 ` [Qemu-devel] [PATCH v2] migration: don't use uninitialized variables Eric Blake
2013-07-30 13:31 ` Luiz Capitulino

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1375141192-1121-1-git-send-email-p.pawit@gmail.com \
    --to=p.pawit@gmail.com \
    --cc=lcapitulino@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    --cc=takano-ryousei@aist.go.jp \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).