提交 d743c382 编写于 作者: A Avi Kivity

vhost: fix incorrect userspace address

MemoryListener::region_add() gives us a slice of a MemoryRegion, not a
region.  Adjust the userspace address to reflect that.
Signed-off-by: NAvi Kivity <avi@redhat.com>
Acked-by: NMichael S. Tsirkin <mst@redhat.com>
上级 e7f92902
......@@ -378,7 +378,7 @@ static void vhost_set_memory(MemoryListener *listener,
assert(size);
/* Optimize no-change case. At least cirrus_vga does this a lot at this time. */
ram = memory_region_get_ram_ptr(section->mr);
ram = memory_region_get_ram_ptr(section->mr) + section->offset_within_region;
if (add) {
if (!vhost_dev_cmp_memory(dev, start_addr, size, (uintptr_t)ram)) {
/* Region exists with same address. Nothing to do. */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册