All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anthony Liguori <aliguori@us.ibm.com>
To: Glauber Costa <glommer@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: [Qemu-devel] Re: [PATCH] fix ioctl return value
Date: Tue, 21 Jul 2009 08:40:36 -0500	[thread overview]
Message-ID: <4A65C554.3020708@us.ibm.com> (raw)
In-Reply-To: <1248183933-20986-1-git-send-email-glommer@redhat.com>

Glauber Costa wrote:
> we expect a number less than 0, not exactly -1.
> And furthermore, we return errno itself, so no need to use it.
>
> This might break guests when this ioctl fails for some reason.
>
> Signed-off-by: Glauber Costa <glommer@redhat.com>
> ---
>  kvm-all.c |    5 ++---
>  1 files changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/kvm-all.c b/kvm-all.c
> index 8567ac9..9a79466 100644
> --- a/kvm-all.c
> +++ b/kvm-all.c
> @@ -319,9 +319,8 @@ int kvm_physical_sync_dirty_bitmap(target_phys_addr_t start_addr,
>
>          d.slot = mem->slot;
>
> -        if (kvm_vm_ioctl(s, KVM_GET_DIRTY_LOG, &d) == -1) {
> -            dprintf("ioctl failed %d\n", errno);
> -            ret = -1;
> +        if ((ret = kvm_vm_ioctl(s, KVM_GET_DIRTY_LOG, &d)) < 0) {
> +            dprintf("ioctl failed %d\n", ret);
>   

While this is fine, I usually prefer:

ret = kvm_vm_ioctl(s, KVM_GET_DIRTY_LOG, &d);
if (ret < 0) {
    dprintf(ioctl failed %d\n", ret);

-- 
Regards,

Anthony Liguori

  reply	other threads:[~2009-07-21 13:40 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-21 13:45 [Qemu-devel] [PATCH] fix ioctl return value Glauber Costa
2009-07-21 13:40 ` Anthony Liguori [this message]
2009-07-21 13:51   ` [Qemu-devel] " Glauber Costa
2009-07-21 13:44     ` Anthony Liguori

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=4A65C554.3020708@us.ibm.com \
    --to=aliguori@us.ibm.com \
    --cc=glommer@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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.