aboutsummaryrefslogtreecommitdiff
path: root/samples
diff options
context:
space:
mode:
authorSwapnil Ingle <swapnil.ingle@nutanix.com>2020-09-28 06:45:17 -0400
committerSwapnil Ingle <swapnil.ingle@nutanix.com>2020-09-28 06:45:17 -0400
commit217b60de1edac35460cab20cf812be8f2ec428f4 (patch)
tree108f543e8fccadc89ae47041eb6469fec19f538e /samples
parent1d04b84719f443656badabdf672da592a4f85e59 (diff)
downloadlibvfio-user-217b60de1edac35460cab20cf812be8f2ec428f4.zip
libvfio-user-217b60de1edac35460cab20cf812be8f2ec428f4.tar.gz
libvfio-user-217b60de1edac35460cab20cf812be8f2ec428f4.tar.bz2
Fix handling of VFIO_USER_DEVICE_GET_INFO
vfio_device_info.argsz is set by the client and server is expected to use/validate it. Signed-off-by: Swapnil Ingle <swapnil.ingle@nutanix.com>
Diffstat (limited to 'samples')
-rw-r--r--samples/client.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/samples/client.c b/samples/client.c
index e8afb11..9756141 100644
--- a/samples/client.c
+++ b/samples/client.c
@@ -94,7 +94,7 @@ set_version(int sock, int client_max_fds, int *server_max_fds)
goto out;
}
- ret = send_version(sock, mj, mn, msg_id, true, client_caps);
+ ret = send_version(sock, mj, mn, msg_id, true, client_caps);
if (ret < 0) {
fprintf(stderr, "failed to send version to server: %s\n",
strerror(-ret));
@@ -111,14 +111,16 @@ static int
get_device_info(int sock)
{
struct vfio_user_header hdr;
- struct vfio_device_info dev_info;
+ struct vfio_device_info dev_info = {
+ .argsz = sizeof(dev_info)
+ };
uint16_t msg_id;
int ret;
int size = sizeof dev_info;
msg_id = 1;
ret = send_vfio_user_msg(sock, msg_id, false, VFIO_USER_DEVICE_GET_INFO,
- NULL, 0, NULL,0);
+ &dev_info, size, NULL,0);
if (ret < 0) {
fprintf(stderr, "%s: failed to send message: %s\n", __func__,
strerror(-ret));