All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu-trivial@nongnu.org, qemu-devel@nongnu.org,
	Stefan Hajnoczi <stefanha@redhat.com>,
	qemu-stable@nongnu.org
Subject: Re: [Qemu-trivial] [Qemu-devel] [PATCH] do not check pointers after dereferencing them
Date: Fri, 31 May 2013 06:46:21 -0600	[thread overview]
Message-ID: <51A89B9D.9010404@redhat.com> (raw)
In-Reply-To: <1370001627-11830-1-git-send-email-pbonzini@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1391 bytes --]

On 05/31/2013 06:00 AM, Paolo Bonzini wrote:
> Two instances, both spotted by Coverity.  In one, two blocks were
> swapped.  In the other, the check is not needed anymore.
> 
> Cc: qemu-stable@nongnu.org
> Cc: qemu-trivial@nongnu.org
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  monitor.c |  2 +-
>  savevm.c  | 10 +++++-----
>  2 files changed, 6 insertions(+), 6 deletions(-)

This version of the savevm.c fix is nicer than Stefan's attempt:
https://lists.gnu.org/archive/html/qemu-devel/2013-05/msg04506.html

Reviewed-by: Eric Blake <eblake@redhat.com>

> +++ b/savevm.c
> @@ -322,16 +322,16 @@ QEMUFile *qemu_popen_cmd(const char *command, const char *mode)
>      FILE *stdio_file;
>      QEMUFileStdio *s;
>  
> -    stdio_file = popen(command, mode);
> -    if (stdio_file == NULL) {
> -        return NULL;
> -    }
> -
>      if (mode == NULL || (mode[0] != 'r' && mode[0] != 'w') || mode[1] != 0) {
>          fprintf(stderr, "qemu_popen: Argument validity check failed\n");
>          return NULL;
>      }
>  
> +    stdio_file = popen(command, mode);
> +    if (stdio_file == NULL) {
> +        return NULL;
> +    }
> +
>      s = g_malloc0(sizeof(QEMUFileStdio));
>  
>      s->stdio_file = stdio_file;
> 

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 621 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: Eric Blake <eblake@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu-trivial@nongnu.org, qemu-devel@nongnu.org,
	Stefan Hajnoczi <stefanha@redhat.com>,
	qemu-stable@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] do not check pointers after dereferencing them
Date: Fri, 31 May 2013 06:46:21 -0600	[thread overview]
Message-ID: <51A89B9D.9010404@redhat.com> (raw)
In-Reply-To: <1370001627-11830-1-git-send-email-pbonzini@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1391 bytes --]

On 05/31/2013 06:00 AM, Paolo Bonzini wrote:
> Two instances, both spotted by Coverity.  In one, two blocks were
> swapped.  In the other, the check is not needed anymore.
> 
> Cc: qemu-stable@nongnu.org
> Cc: qemu-trivial@nongnu.org
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  monitor.c |  2 +-
>  savevm.c  | 10 +++++-----
>  2 files changed, 6 insertions(+), 6 deletions(-)

This version of the savevm.c fix is nicer than Stefan's attempt:
https://lists.gnu.org/archive/html/qemu-devel/2013-05/msg04506.html

Reviewed-by: Eric Blake <eblake@redhat.com>

> +++ b/savevm.c
> @@ -322,16 +322,16 @@ QEMUFile *qemu_popen_cmd(const char *command, const char *mode)
>      FILE *stdio_file;
>      QEMUFileStdio *s;
>  
> -    stdio_file = popen(command, mode);
> -    if (stdio_file == NULL) {
> -        return NULL;
> -    }
> -
>      if (mode == NULL || (mode[0] != 'r' && mode[0] != 'w') || mode[1] != 0) {
>          fprintf(stderr, "qemu_popen: Argument validity check failed\n");
>          return NULL;
>      }
>  
> +    stdio_file = popen(command, mode);
> +    if (stdio_file == NULL) {
> +        return NULL;
> +    }
> +
>      s = g_malloc0(sizeof(QEMUFileStdio));
>  
>      s->stdio_file = stdio_file;
> 

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 621 bytes --]

  reply	other threads:[~2013-05-31 12:46 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-31 12:00 [Qemu-trivial] [PATCH] do not check pointers after dereferencing them Paolo Bonzini
2013-05-31 12:00 ` [Qemu-devel] " Paolo Bonzini
2013-05-31 12:46 ` Eric Blake [this message]
2013-05-31 12:46   ` Eric Blake
2013-06-03  7:58   ` [Qemu-trivial] " Stefan Hajnoczi
2013-06-03  7:58     ` Stefan Hajnoczi
2013-05-31 15:39 ` [Qemu-trivial] " Michael Tokarev
2013-05-31 15:39   ` [Qemu-devel] " Michael Tokarev

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=51A89B9D.9010404@redhat.com \
    --to=eblake@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-stable@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    --cc=stefanha@redhat.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.