aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorAvi Kivity <avi@redhat.com>2012-01-09 13:09:40 +0200
committerAvi Kivity <avi@redhat.com>2012-01-09 13:09:40 +0200
commitd743c382861eaa1e13f503b05aba5a382a7e7f7c (patch)
tree5c0665f1a2b2cd8bdf585c40773cc636f5a65bc7 /hw
parente7f929028cc11a439ee7bbdf40724d87016361fa (diff)
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 <avi@redhat.com> Acked-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/vhost.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/hw/vhost.c b/hw/vhost.c
index cd56e75d0a..541c7163b2 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. */