aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Henderson <william.henderson@nutanix.com>2023-07-20 15:54:52 +0000
committerJohn Levon <john.levon@nutanix.com>2023-09-15 12:59:39 +0100
commit951f92270d94e5cc7e688625283c2a293f2f0399 (patch)
treee419cdd018486a0565c74a18a8589374d1e19589
parent8c0439512912305ff6ea0cde3ed2daa7f9dd3f82 (diff)
downloadlibvfio-user-951f92270d94e5cc7e688625283c2a293f2f0399.zip
libvfio-user-951f92270d94e5cc7e688625283c2a293f2f0399.tar.gz
libvfio-user-951f92270d94e5cc7e688625283c2a293f2f0399.tar.bz2
fix: bugs in dirty page logging
Signed-off-by: William Henderson <william.henderson@nutanix.com>
-rw-r--r--lib/dma.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/lib/dma.c b/lib/dma.c
index d70628a..8000406 100644
--- a/lib/dma.c
+++ b/lib/dma.c
@@ -327,6 +327,7 @@ ssize_t
dma_feature_get(vfu_ctx_t *vfu_ctx, uint32_t feature, void *buf)
{
assert(vfu_ctx != NULL);
+ assert(feature == VFIO_DEVICE_FEATURE_DMA_LOGGING_REPORT);
struct dma_controller *dma = vfu_ctx->dma;
@@ -336,16 +337,15 @@ dma_feature_get(vfu_ctx_t *vfu_ctx, uint32_t feature, void *buf)
ssize_t bitmap_size = get_bitmap_size(req->length, req->page_size);
- int ret;
-
- ret = dma_controller_dirty_page_get(dma,
- req->iova,
- req->length,
- req->page_size,
- bitmap_size,
- buf + sizeof(struct vfio_user_device_feature_dma_logging_report));
+ char* bitmap = (char*) buf
+ + sizeof(struct vfio_user_device_feature_dma_logging_report);
- return -1;
+ return dma_controller_dirty_page_get(dma,
+ (vfu_dma_addr_t) req->iova,
+ req->length,
+ req->page_size,
+ bitmap_size,
+ bitmap);
}
/*