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<address@hidden>
---
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;