]> www.infradead.org Git - users/dwmw2/qemu.git/commitdiff
vhost: use QEMU_ALIGN_DOWN
authorMarc-André Lureau <marcandre.lureau@redhat.com>
Thu, 22 Jun 2017 11:04:16 +0000 (13:04 +0200)
committerMarc-André Lureau <marcandre.lureau@redhat.com>
Thu, 31 Aug 2017 10:29:07 +0000 (12:29 +0200)
I used the clang-tidy qemu-round check to generate the fix:
https://github.com/elmarco/clang-tools-extra

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
hw/virtio/vhost.c

index 6eddb099b02f94c92cb3d5027cced243bd7eb1d5..0049a2c0b39303ef784160aac4f191b2562651ab 100644 (file)
@@ -70,7 +70,7 @@ static void vhost_dev_sync_region(struct vhost_dev *dev,
     uint64_t end = MIN(mlast, rlast);
     vhost_log_chunk_t *from = log + start / VHOST_LOG_CHUNK;
     vhost_log_chunk_t *to = log + end / VHOST_LOG_CHUNK + 1;
-    uint64_t addr = (start / VHOST_LOG_CHUNK) * VHOST_LOG_CHUNK;
+    uint64_t addr = QEMU_ALIGN_DOWN(start, VHOST_LOG_CHUNK);
 
     if (end < start) {
         return;