From patchwork Mon Jan 9 12:04:52 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Avi Kivity X-Patchwork-Id: 135008 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id AB5DEB6F99 for ; Mon, 9 Jan 2012 23:16:42 +1100 (EST) Received: from localhost ([::1]:53225 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RkE9U-0003uQ-0x for incoming@patchwork.ozlabs.org; Mon, 09 Jan 2012 07:16:36 -0500 Received: from eggs.gnu.org ([140.186.70.92]:34747) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RkE9J-0003sI-JR for qemu-devel@nongnu.org; Mon, 09 Jan 2012 07:16:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RkE9I-0006aL-Kd for qemu-devel@nongnu.org; Mon, 09 Jan 2012 07:16:25 -0500 Received: from mx1.redhat.com ([209.132.183.28]:55471) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RkE9I-0006aA-E0 for qemu-devel@nongnu.org; Mon, 09 Jan 2012 07:16:24 -0500 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q09CGNCk011909 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 9 Jan 2012 07:16:23 -0500 Received: from cleopatra.tlv.redhat.com (cleopatra.tlv.redhat.com [10.35.255.11]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q09C5AKb026823 for ; Mon, 9 Jan 2012 07:05:10 -0500 Received: from s01.tlv.redhat.com (s01.tlv.redhat.com [10.35.255.8]) by cleopatra.tlv.redhat.com (Postfix) with ESMTP id 45655250BA7; Mon, 9 Jan 2012 14:05:03 +0200 (IST) From: Avi Kivity To: "Michael S. Tsirkin" Date: Mon, 9 Jan 2012 14:04:52 +0200 Message-Id: <1326110694-5196-2-git-send-email-avi@redhat.com> In-Reply-To: <1326110694-5196-1-git-send-email-avi@redhat.com> References: <1326110694-5196-1-git-send-email-avi@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 209.132.183.28 Cc: qemu-devel@nongnu.org Subject: [Qemu-devel] [PATCH 1/3] vhost: fix incorrect userspace address X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 files changed, 1 insertions(+), 1 deletions(-) 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. */