From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:40420) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RkFF3-0000dX-9r for qemu-devel@nongnu.org; Mon, 09 Jan 2012 08:26:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RkFEy-00006j-Fe for qemu-devel@nongnu.org; Mon, 09 Jan 2012 08:26:25 -0500 Received: from mx1.redhat.com ([209.132.183.28]:63735) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RkFEy-00006c-6R for qemu-devel@nongnu.org; Mon, 09 Jan 2012 08:26:20 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q09DQJkr002441 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 9 Jan 2012 08:26:19 -0500 Date: Mon, 9 Jan 2012 15:28:27 +0200 From: "Michael S. Tsirkin" Message-ID: <20120109132827.GB23401@redhat.com> References: <1326110694-5196-1-git-send-email-avi@redhat.com> <1326110694-5196-3-git-send-email-avi@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1326110694-5196-3-git-send-email-avi@redhat.com> Subject: Re: [Qemu-devel] [PATCH 2/3] vhost: fix mem_sections memory corruption List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Avi Kivity Cc: qemu-devel@nongnu.org On Mon, Jan 09, 2012 at 02:04:53PM +0200, Avi Kivity wrote: > A memset() used to delete an entry in an array did not take into account > the array element's size. > > 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 541c716..d924fb0 100644 > --- a/hw/vhost.c > +++ b/hw/vhost.c > @@ -456,7 +456,7 @@ static void vhost_region_del(MemoryListener *listener, > == section->offset_within_address_space) { > --dev->n_mem_sections; > memmove(&dev->mem_sections[i], &dev->mem_sections[i+1], > - dev->n_mem_sections - i); > + (dev->n_mem_sections - i) * sizeof(*dev->mem_sections)); > break; > } > } > -- > 1.7.7.1 >