From d743c382861eaa1e13f503b05aba5a382a7e7f7c Mon Sep 17 00:00:00 2001 From: Avi Kivity Date: Mon, 9 Jan 2012 13:09:40 +0200 Subject: [PATCH] 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: Avi Kivity Acked-by: Michael S. Tsirkin --- hw/vhost.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/vhost.c b/hw/vhost.c index cd56e75..541c716 100644 --- a/hw/vhost.c +++ b/hw/vhost.c @@ -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. */ -- 2.7.4