diff --git a/hw/vhost.c b/hw/vhost.c
index 8d41fdb..dbf6b46 100644
--- a/hw/vhost.c
+++ b/hw/vhost.c
@@ -55,7 +55,7 @@ static void vhost_dev_sync_region(struct vhost_dev *dev,
                 ffsll(log) : ffs(log))) {
             ram_addr_t ram_addr;
             bit -= 1;
-            ram_addr = section->offset_within_region + bit * VHOST_LOG_PAGE;
+            ram_addr = section->offset_within_region + addr + bit * VHOST_LOG_PAGE;
             memory_region_set_dirty(section->mr, ram_addr, VHOST_LOG_PAGE);
             log &= ~(0x1ull << bit);
         }
@@ -94,7 +94,7 @@ static void vhost_log_sync(MemoryListener *listener,
     struct vhost_dev *dev = container_of(listener, struct vhost_dev,
                                          memory_listener);
     hwaddr start_addr = section->offset_within_address_space;
-    hwaddr end_addr = start_addr + section->size;
+    hwaddr end_addr = start_addr + section->size - 1;
 
     vhost_sync_dirty_bitmap(dev, section, start_addr, end_addr);
 }
