All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: arei.gonglei@huawei.com, qemu-devel@nongnu.org
Cc: amit.shah@redhat.com, qemu-trivial@nongnu.org,
	weidong.huang@huawei.com, quintela@redhat.com
Subject: Re: [Qemu-trivial] [PATCH] vl.c: Fix Coverity complaining for vmstate_dump_file
Date: Wed, 29 Oct 2014 14:05:16 +0100	[thread overview]
Message-ID: <5450E60C.2020200@redhat.com> (raw)
In-Reply-To: <1414586983-10816-1-git-send-email-arei.gonglei@huawei.com>

On 10/29/2014 01:49 PM, arei.gonglei@huawei.com wrote:
> From: Gonglei <arei.gonglei@huawei.com>
> 
> commit abfd9ce3(migration: dump vmstate info as a json
> file for static analysis) introduce a new command,
> '-dump-vmstate', that takes a filename
> as an argument.  When executed, QEMU will dump the vmstate information
> for the machine type it's invoked with to the file, and quit.
> 
> Apparently, it supports one '-dump-vmstate' option,
> otherwise, the vmstate_dump_file will be overwritten.
> 
> Of course, the resource will be freed when Qemu quit, but The code logic
> is not good, it will make Coverity complaining.
> 
> Signed-off-by: Gonglei <arei.gonglei@huawei.com>
> ---
>  vl.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/vl.c b/vl.c
> index f6b3546..5ef3af9 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -3746,6 +3746,11 @@ int main(int argc, char **argv, char **envp)
>                  configure_msg(opts);
>                  break;
>              case QEMU_OPTION_dump_vmstate:
> +                if (vmstate_dump_file) {
> +                    fprintf(stderr, "qemu: only one '-dump-vmstate' "
> +                            "option may be given\n");
> +                    exit(1);
> +                }
>                  vmstate_dump_file = fopen(optarg, "w");
>                  if (vmstate_dump_file == NULL) {
>                      fprintf(stderr, "open %s: %s\n", optarg, strerror(errno));
> 

Applied, thanks.

Paolo


WARNING: multiple messages have this Message-ID (diff)
From: Paolo Bonzini <pbonzini@redhat.com>
To: arei.gonglei@huawei.com, qemu-devel@nongnu.org
Cc: amit.shah@redhat.com, qemu-trivial@nongnu.org,
	weidong.huang@huawei.com, quintela@redhat.com
Subject: Re: [Qemu-devel] [PATCH] vl.c: Fix Coverity complaining for vmstate_dump_file
Date: Wed, 29 Oct 2014 14:05:16 +0100	[thread overview]
Message-ID: <5450E60C.2020200@redhat.com> (raw)
In-Reply-To: <1414586983-10816-1-git-send-email-arei.gonglei@huawei.com>

On 10/29/2014 01:49 PM, arei.gonglei@huawei.com wrote:
> From: Gonglei <arei.gonglei@huawei.com>
> 
> commit abfd9ce3(migration: dump vmstate info as a json
> file for static analysis) introduce a new command,
> '-dump-vmstate', that takes a filename
> as an argument.  When executed, QEMU will dump the vmstate information
> for the machine type it's invoked with to the file, and quit.
> 
> Apparently, it supports one '-dump-vmstate' option,
> otherwise, the vmstate_dump_file will be overwritten.
> 
> Of course, the resource will be freed when Qemu quit, but The code logic
> is not good, it will make Coverity complaining.
> 
> Signed-off-by: Gonglei <arei.gonglei@huawei.com>
> ---
>  vl.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/vl.c b/vl.c
> index f6b3546..5ef3af9 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -3746,6 +3746,11 @@ int main(int argc, char **argv, char **envp)
>                  configure_msg(opts);
>                  break;
>              case QEMU_OPTION_dump_vmstate:
> +                if (vmstate_dump_file) {
> +                    fprintf(stderr, "qemu: only one '-dump-vmstate' "
> +                            "option may be given\n");
> +                    exit(1);
> +                }
>                  vmstate_dump_file = fopen(optarg, "w");
>                  if (vmstate_dump_file == NULL) {
>                      fprintf(stderr, "open %s: %s\n", optarg, strerror(errno));
> 

Applied, thanks.

Paolo

  parent reply	other threads:[~2014-10-29 13:05 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-29 12:49 [Qemu-trivial] [PATCH] vl.c: Fix Coverity complaining for vmstate_dump_file arei.gonglei
2014-10-29 12:49 ` [Qemu-devel] " arei.gonglei
2014-10-29 12:59 ` [Qemu-trivial] " Amit Shah
2014-10-29 12:59   ` [Qemu-devel] " Amit Shah
2014-10-29 13:05 ` Paolo Bonzini [this message]
2014-10-29 13:05   ` Paolo Bonzini

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=5450E60C.2020200@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=amit.shah@redhat.com \
    --cc=arei.gonglei@huawei.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    --cc=quintela@redhat.com \
    --cc=weidong.huang@huawei.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.