diff options
author | Thanos Makatos <thanos.makatos@nutanix.com> | 2020-12-18 15:38:29 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-18 15:38:29 +0000 |
commit | 074c64dacb9eb2f281c9489c3797309199894e82 (patch) | |
tree | 938b11bab460fe8e4db9e2bc83c4556c129030d1 /lib | |
parent | a764a3d66eb5a04dea769be15d88ef0ac4e5a5ea (diff) | |
download | libvfio-user-074c64dacb9eb2f281c9489c3797309199894e82.zip libvfio-user-074c64dacb9eb2f281c9489c3797309199894e82.tar.gz libvfio-user-074c64dacb9eb2f281c9489c3797309199894e82.tar.bz2 |
don't set wrong buffer size when replying to device info region (#217)
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libvfio-user.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/libvfio-user.c b/lib/libvfio-user.c index e2af26f..7f0bb0b 100644 --- a/lib/libvfio-user.c +++ b/lib/libvfio-user.c @@ -905,7 +905,7 @@ exec_command(vfu_ctx_t *vfu_ctx, struct vfio_user_header *hdr, size_t size, int ret; struct vfio_irq_info *irq_info; struct vfio_device_info *dev_info; - struct vfio_region_info *dev_reg_info = NULL; + struct vfio_region_info *dev_region_info_in, *dev_region_info_out = NULL; void *cmd_data = NULL; assert(vfu_ctx != NULL); @@ -976,12 +976,14 @@ exec_command(vfu_ctx_t *vfu_ctx, struct vfio_user_header *hdr, size_t size, } break; case VFIO_USER_DEVICE_GET_REGION_INFO: - ret = handle_device_get_region_info(vfu_ctx, hdr->msg_size, cmd_data, - &dev_reg_info, fds_out, + dev_region_info_in = cmd_data; + ret = handle_device_get_region_info(vfu_ctx, hdr->msg_size, + dev_region_info_in, + &dev_region_info_out, fds_out, nr_fds_out); if (ret == 0) { - _iovecs[1].iov_base = dev_reg_info; - _iovecs[1].iov_len = hdr->msg_size; + _iovecs[1].iov_base = dev_region_info_out; + _iovecs[1].iov_len = dev_region_info_in->argsz; *iovecs = _iovecs; *nr_iovecs = 2; } |