All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Tokarev <mjt@tls.msk.ru>
To: Mario Smarduch <m.smarduch@samsung.com>
Cc: qemu-trivial@nongnu.org, qemu-devel <qemu-devel@nongnu.org>
Subject: Re: [Qemu-trivial] [Qemu-devel][PATCH] fix return check for KVM_GET_DIRTY_LOG ioctl
Date: Thu, 20 Mar 2014 19:45:00 +0400	[thread overview]
Message-ID: <532B0CFC.6070309@msgid.tls.msk.ru> (raw)
In-Reply-To: <5329D2CA.6020909@samsung.com>

19.03.2014 21:24, Mario Smarduch wrote:
> 
> Fix return condition check from kvm_vm_ioctl(s, KVM_GET_DIRTY_LOG, &d) to
> handle internal failures or no support for memory slot dirty bitmap.
> Otherwise the ioctl succeeds and continues with migration.
> Addresses BUG# 1294227

Thanks, applied to -trivial.

[]
> -        if (kvm_vm_ioctl(s, KVM_GET_DIRTY_LOG, &d) == -1) {
> +        if (kvm_vm_ioctl(s, KVM_GET_DIRTY_LOG, &d) < 0) {

Actually I'd make all error checks like this.  Many checks compares
return value with -1 for some reason, while actually, any <0 value
should be treated as error in many many places...  At the same time,
comparison with 0 is cheaper than comparison with -1 ;)

/mjt


WARNING: multiple messages have this Message-ID (diff)
From: Michael Tokarev <mjt@tls.msk.ru>
To: Mario Smarduch <m.smarduch@samsung.com>
Cc: qemu-trivial@nongnu.org, qemu-devel <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [Qemu-trivial] [PATCH] fix return check for KVM_GET_DIRTY_LOG ioctl
Date: Thu, 20 Mar 2014 19:45:00 +0400	[thread overview]
Message-ID: <532B0CFC.6070309@msgid.tls.msk.ru> (raw)
In-Reply-To: <5329D2CA.6020909@samsung.com>

19.03.2014 21:24, Mario Smarduch wrote:
> 
> Fix return condition check from kvm_vm_ioctl(s, KVM_GET_DIRTY_LOG, &d) to
> handle internal failures or no support for memory slot dirty bitmap.
> Otherwise the ioctl succeeds and continues with migration.
> Addresses BUG# 1294227

Thanks, applied to -trivial.

[]
> -        if (kvm_vm_ioctl(s, KVM_GET_DIRTY_LOG, &d) == -1) {
> +        if (kvm_vm_ioctl(s, KVM_GET_DIRTY_LOG, &d) < 0) {

Actually I'd make all error checks like this.  Many checks compares
return value with -1 for some reason, while actually, any <0 value
should be treated as error in many many places...  At the same time,
comparison with 0 is cheaper than comparison with -1 ;)

/mjt

  reply	other threads:[~2014-03-20 15:45 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-19 17:24 [Qemu-trivial] [Qemu-devel][PATCH] fix return check for KVM_GET_DIRTY_LOG ioctl Mario Smarduch
2014-03-19 17:24 ` [Qemu-devel] [PATCH] " Mario Smarduch
2014-03-20 15:45 ` Michael Tokarev [this message]
2014-03-20 15:45   ` [Qemu-devel] [Qemu-trivial] " Michael Tokarev
2014-03-20 16:38   ` [Qemu-trivial] [Qemu-devel][PATCH] " Mario Smarduch
2014-03-20 16:38     ` [Qemu-devel] [Qemu-trivial] [PATCH] " Mario Smarduch

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=532B0CFC.6070309@msgid.tls.msk.ru \
    --to=mjt@tls.msk.ru \
    --cc=m.smarduch@samsung.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@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.