mirror of https://github.com/xemu-project/xemu.git
vhost-user: fix mmap offset calculation
qemu_get_ram_block_host_ptr should get ram_addr_t, vhost-user passes in GPA. That's very wrong. Reported-by: Linhaifeng <haifeng.lin@huawei.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
parent
ac369a7796
commit
d3f16ec887
|
@ -226,7 +226,7 @@ static int vhost_user_call(struct vhost_dev *dev, unsigned long int request,
|
|||
msg.memory.regions[fd_num].memory_size = reg->memory_size;
|
||||
msg.memory.regions[fd_num].guest_phys_addr = reg->guest_phys_addr;
|
||||
msg.memory.regions[fd_num].mmap_offset = reg->userspace_addr -
|
||||
(uintptr_t) qemu_get_ram_block_host_ptr(reg->guest_phys_addr);
|
||||
(uintptr_t) qemu_get_ram_block_host_ptr(ram_addr);
|
||||
assert(fd_num < VHOST_MEMORY_MAX_NREGIONS);
|
||||
fds[fd_num++] = fd;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue