qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Luiz Capitulino <lcapitulino@redhat.com>
To: Eric Blake <eblake@redhat.com>
Cc: Pawit Pornkitprasan <p.pawit@gmail.com>,
	qemu-devel@nongnu.org, Ryousei Takano <takano-ryousei@aist.go.jp>,
	Juan Quintela <quintela@redhat.com>
Subject: Re: [Qemu-devel] [PATCH] migration: don't use uninitialized variables
Date: Mon, 29 Jul 2013 17:05:23 -0400	[thread overview]
Message-ID: <20130729170523.4e6a62eb@redhat.com> (raw)
In-Reply-To: <51E91BAF.4050903@redhat.com>

On Fri, 19 Jul 2013 04:57:51 -0600
Eric Blake <eblake@redhat.com> wrote:

> On 07/18/2013 08:36 PM, Pawit Pornkitprasan wrote:
> > 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 file changed, 2 insertions(+), 2 deletions(-)
> 
> Reviewed-by: Eric Blake <eblake@redhat.com>
> 
> However, wouldn't it be nice if we improved the qapi generator to
> guarantee a sane default value for optional parameters, even when
> has_value is false?

We could do that for bool and pointers, but this wouldn't help
integers and enums. Also, even if we had default values, I guess
I'd enforce a common idiom for handling optionals as this is also
a good practice for preventing bugs.

  parent reply	other threads:[~2013-07-29 21:05 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-19  2:36 [Qemu-devel] [PATCH] migration: don't use uninitialized variables Pawit Pornkitprasan
2013-07-19 10:57 ` Eric Blake
2013-07-19 11:04   ` Pawit Pornkitprasan
2013-07-19 11:13     ` Eric Blake
2013-07-29 21:05   ` Luiz Capitulino [this message]
2013-07-30  0:15     ` Markus Armbruster
2013-07-30  1:29       ` Anthony Liguori
2013-07-30  6:39         ` Markus Armbruster
2013-07-30 13:26           ` Anthony Liguori
2013-07-30 15:22             ` Markus Armbruster
2013-07-22  7:32 ` Orit Wasserman
2013-07-29 20:52 ` Luiz Capitulino
2013-07-29 23:29   ` Pawit Pornkitprasan

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=20130729170523.4e6a62eb@redhat.com \
    --to=lcapitulino@redhat.com \
    --cc=eblake@redhat.com \
    --cc=p.pawit@gmail.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).