Skip to contentSkip to conversation

vhost-user: fix log size

PATCH In review Michael S. Tsirkin 2 participants 2 messages Nov 18, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 vhost-user: fix log size

commit 2b8819c6eee517c1582983773f8555bb3f9ed645 ("vhost-user: modify SET_LOG_BASE to pass mmap size and offset") passes log size in units of 4 byte chunks instead of the expected size in bytes.

Fix this up.

---
 hw/virtio/vhost-user.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/virtio/vhost-user.c +1 -1
index 71c3e16..1b6c5ac 100644
@@ -206,7 +206,7 @@ static int vhost_user_set_log_base(struct vhost_dev *dev, uint64_t base,
     VhostUserMsg msg = {
         .request = VHOST_USER_SET_LOG_BASE,
         .flags = VHOST_USER_VERSION,
-        .payload.log.mmap_size = log->size,
+        .payload.log.mmap_size = log->size * sizeof(*(log->log)),
         .payload.log.mmap_offset = 0,
         .size = sizeof(msg.payload.log),
     };
Signature · 1 line
MST
Reviewed-by on v1 1/1
#1 lore raw
Quoted 28 lines · Michael S. Tsirkin

commit 2b8819c6eee517c1582983773f8555bb3f9ed645 ("vhost-user: modify SET_LOG_BASE to pass mmap size and offset") passes log size in units of 4 byte chunks instead of the expected size in bytes.

Fix this up.

---
 hw/virtio/vhost-user.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/virtio/vhost-user.c +1 -2
index 71c3e16..1b6c5ac 100644
@@ -206,7 +206,7 @@ static int vhost_user_set_log_base(struct vhost_dev *dev, uint64_t base,
     VhostUserMsg msg = {
         .request = VHOST_USER_SET_LOG_BASE,
         .flags = VHOST_USER_VERSION,
-        .payload.log.mmap_size = log->size,
+        .payload.log.mmap_size = log->size * sizeof(*(log->log)),
         .payload.log.mmap_offset = 0,
         .size = sizeof(msg.payload.log),
     };
--

MST

Signature · 1 line
Marc-André Lureau