qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Bruce Rogers <brogers@suse.com>
To: qemu-devel@nongnu.org
Cc: Bruce Rogers <brogers@suse.com>, mst@redhat.com
Subject: [Qemu-devel] [PATCH] vhost-net: Move asserts to after check for end < start
Date: Fri, 16 Dec 2011 13:33:27 -0700	[thread overview]
Message-ID: <1324067607-17055-1-git-send-email-brogers@suse.com> (raw)

When migrating a vm using vhost-net we hit the following assertion:

qemu-kvm: /usr/src/packages/BUILD/qemu-kvm-0.15.1/hw/vhost.c:30:
vhost_dev_sync_region: Assertion `start / (0x1000 * (8 *
sizeof(vhost_log_chunk_t))) < dev->log_size' failed.

The cases which the end < start check is intended to catch, such as
for vga video memory, will also likely trigger the assertion.
Reorder the code to handle this correctly.

Signed-off-by: Bruce Rogers <brogers@suse.com>
---
 hw/vhost.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/vhost.c b/hw/vhost.c
index 0870cb7..7309f71 100644
--- a/hw/vhost.c
+++ b/hw/vhost.c
@@ -26,11 +26,11 @@ static void vhost_dev_sync_region(struct vhost_dev *dev,
     vhost_log_chunk_t *to = dev->log + end / VHOST_LOG_CHUNK + 1;
     uint64_t addr = (start / VHOST_LOG_CHUNK) * VHOST_LOG_CHUNK;
 
-    assert(end / VHOST_LOG_CHUNK < dev->log_size);
-    assert(start / VHOST_LOG_CHUNK < dev->log_size);
     if (end < start) {
         return;
     }
+    assert(end / VHOST_LOG_CHUNK < dev->log_size);
+    assert(start / VHOST_LOG_CHUNK < dev->log_size);
     for (;from < to; ++from) {
         vhost_log_chunk_t log;
         int bit;
-- 
1.7.7

             reply	other threads:[~2011-12-16 21:13 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-16 20:33 Bruce Rogers [this message]
2012-03-31  2:21 ` [Qemu-devel] [PATCH] vhost-net: Move asserts to after check for end < start Josh Durgin
2012-04-01  8:54   ` Michael S. Tsirkin

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=1324067607-17055-1-git-send-email-brogers@suse.com \
    --to=brogers@suse.com \
    --cc=mst@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 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).