]> git.proxmox.com Git - mirror_qemu.git/commitdiff
vhost-user: cleanup msg size math
authorMichael S. Tsirkin <mst@redhat.com>
Thu, 22 Oct 2015 19:33:39 +0000 (22:33 +0300)
committerMichael S. Tsirkin <mst@redhat.com>
Thu, 29 Oct 2015 09:05:24 +0000 (11:05 +0200)
We are sending msg fields, use sizeof on these
and not on local variables which happen to
have a matching type.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
hw/virtio/vhost-user.c

index dce4dd35e94ddc6f6c5b8de06d8d92babb487802..83c84f1cd684745cf50c2745561bec3e6927d44c 100644 (file)
@@ -281,7 +281,7 @@ static int vhost_user_set_vring_addr(struct vhost_dev *dev,
         .request = VHOST_USER_SET_VRING_ADDR,
         .flags = VHOST_USER_VERSION,
         .payload.addr = *addr,
-        .size = sizeof(*addr),
+        .size = sizeof(msg.payload.addr),
     };
 
     vhost_user_write(dev, &msg, NULL, 0);
@@ -304,7 +304,7 @@ static int vhost_set_vring(struct vhost_dev *dev,
         .request = request,
         .flags = VHOST_USER_VERSION,
         .payload.state = *ring,
-        .size = sizeof(*ring),
+        .size = sizeof(msg.payload.state),
     };
 
     vhost_user_write(dev, &msg, NULL, 0);
@@ -346,7 +346,7 @@ static int vhost_user_get_vring_base(struct vhost_dev *dev,
         .request = VHOST_USER_GET_VRING_BASE,
         .flags = VHOST_USER_VERSION,
         .payload.state = *ring,
-        .size = sizeof(*ring),
+        .size = sizeof(msg.payload.state),
     };
 
     vhost_user_write(dev, &msg, NULL, 0);