diff options
author | Michael S. Tsirkin <mst@redhat.com> | 2015-10-22 22:33:39 +0300 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2015-10-29 11:05:24 +0200 |
commit | 7fc0246c0792767b732c0989e8eba24bea185feb (patch) | |
tree | 0316635fbb9347d2f4cf4ffe565f17334ba887d1 | |
parent | 86abad0fedc44554adde5e189cf7edfa5b1c948e (diff) |
vhost-user: cleanup msg size math
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>
-rw-r--r-- | hw/virtio/vhost-user.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c index dce4dd35e9..83c84f1cd6 100644 --- a/hw/virtio/vhost-user.c +++ b/hw/virtio/vhost-user.c @@ -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); |