aboutsummaryrefslogtreecommitdiff
path: root/samples
diff options
context:
space:
mode:
authorThanos Makatos <thanos.makatos@nutanix.com>2020-11-16 09:29:19 -0500
committerThanos Makatos <thanos.makatos@nutanix.com>2020-11-16 09:50:10 -0500
commit5bec2b0cd1f70d5c6a8a71abe6670eac80f0733f (patch)
tree662a3b812500a3d65e63a696f5977ca88e5d731b /samples
parent94e654b7b84645a941612c2aba66fca1c7c923f1 (diff)
downloadlibvfio-user-5bec2b0cd1f70d5c6a8a71abe6670eac80f0733f.zip
libvfio-user-5bec2b0cd1f70d5c6a8a71abe6670eac80f0733f.tar.gz
libvfio-user-5bec2b0cd1f70d5c6a8a71abe6670eac80f0733f.tar.bz2
validate argsz
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
Diffstat (limited to 'samples')
-rw-r--r--samples/client.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/samples/client.c b/samples/client.c
index e49230b..d6be91d 100644
--- a/samples/client.c
+++ b/samples/client.c
@@ -581,6 +581,7 @@ get_dirty_bitmaps(int sock, struct vfio_user_dma_region *dma_regions,
* FIXME there should be at least two IOVAs. Send single message for two
* IOVAs and ensure only one bit is set in first IOVA.
*/
+ dirty_bitmap.argsz = sizeof(dirty_bitmap) + ARRAY_SIZE(bitmaps) * sizeof(struct vfio_iommu_type1_dirty_bitmap_get);
dirty_bitmap.flags = VFIO_IOMMU_DIRTY_PAGES_FLAG_GET_BITMAP;
ret = _send_recv_vfio_user_msg(sock, 0, VFIO_USER_DIRTY_PAGES,
iovecs, ARRAY_SIZE(iovecs),
@@ -827,6 +828,7 @@ int main(int argc, char *argv[])
}
+ dirty_bitmap.argsz = sizeof dirty_bitmap;
dirty_bitmap.flags = VFIO_IOMMU_DIRTY_PAGES_FLAG_START;
ret = send_recv_vfio_user_msg(sock, 0, VFIO_USER_DIRTY_PAGES,
&dirty_bitmap, sizeof dirty_bitmap,
@@ -861,6 +863,7 @@ int main(int argc, char *argv[])
exit(EXIT_FAILURE);
}
+ dirty_bitmap.argsz = sizeof dirty_bitmap;
dirty_bitmap.flags = VFIO_IOMMU_DIRTY_PAGES_FLAG_STOP;
ret = send_recv_vfio_user_msg(sock, 0, VFIO_USER_DIRTY_PAGES,
&dirty_bitmap, sizeof dirty_bitmap,