[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v1 01/15] libvhost-user: Fix msg_region->userspace_addr computati
From: |
David Hildenbrand |
Subject: |
[PATCH v1 01/15] libvhost-user: Fix msg_region->userspace_addr computation |
Date: |
Fri, 2 Feb 2024 22:53:18 +0100 |
We barely had mmap_offset set in the past. With virtio-mem and
dynamic-memslots that will change.
In vu_add_mem_reg() and vu_set_mem_table_exec_postcopy(), we are
performing pointer arithmetics, which is wrong. Let's simply
use dev_region->mmap_addr instead of "void *mmap_addr".
Fixes: ec94c8e621de ("Support adding individual regions in libvhost-user")
Fixes: 9bb38019942c ("vhost+postcopy: Send address back to qemu")
Cc: Raphael Norwitz <raphael.norwitz@nutanix.com>
Signed-off-by: David Hildenbrand <david@redhat.com>
---
subprojects/libvhost-user/libvhost-user.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/subprojects/libvhost-user/libvhost-user.c
b/subprojects/libvhost-user/libvhost-user.c
index a3b158c671..7e515ed15d 100644
--- a/subprojects/libvhost-user/libvhost-user.c
+++ b/subprojects/libvhost-user/libvhost-user.c
@@ -800,8 +800,8 @@ vu_add_mem_reg(VuDev *dev, VhostUserMsg *vmsg) {
* Return the address to QEMU so that it can translate the ufd
* fault addresses back.
*/
- msg_region->userspace_addr = (uintptr_t)(mmap_addr +
- dev_region->mmap_offset);
+ msg_region->userspace_addr = dev_region->mmap_addr +
+ dev_region->mmap_offset;
/* Send the message back to qemu with the addresses filled in. */
vmsg->fd_num = 0;
@@ -969,8 +969,8 @@ vu_set_mem_table_exec_postcopy(VuDev *dev, VhostUserMsg
*vmsg)
/* Return the address to QEMU so that it can translate the ufd
* fault addresses back.
*/
- msg_region->userspace_addr = (uintptr_t)(mmap_addr +
- dev_region->mmap_offset);
+ msg_region->userspace_addr = dev_region->mmap_addr +
+ dev_region->mmap_offset;
close(vmsg->fds[i]);
}
--
2.43.0
[PATCH v1 02/15] libvhost-user: Dynamically allocate memory for memory slots, David Hildenbrand, 2024/02/02
[PATCH v1 03/15] libvhost-user: Bump up VHOST_USER_MAX_RAM_SLOTS to 509, David Hildenbrand, 2024/02/02