qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Avi Kivity <avi@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 2/3] vhost: fix mem_sections memory corruption
Date: Mon, 9 Jan 2012 15:28:27 +0200	[thread overview]
Message-ID: <20120109132827.GB23401@redhat.com> (raw)
In-Reply-To: <1326110694-5196-3-git-send-email-avi@redhat.com>

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 <avi@redhat.com>

Acked-by: Michael S. Tsirkin <mst@redhat.com>

> ---
>  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
> 

  reply	other threads:[~2012-01-09 13:26 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-09 12:04 [Qemu-devel] [PATCH 0/3] Fix vhost after memory API breakage Avi Kivity
2012-01-09 12:04 ` [Qemu-devel] [PATCH 1/3] vhost: fix incorrect userspace address Avi Kivity
2012-01-09 13:28   ` Michael S. Tsirkin
2012-01-09 12:04 ` [Qemu-devel] [PATCH 2/3] vhost: fix mem_sections memory corruption Avi Kivity
2012-01-09 13:28   ` Michael S. Tsirkin [this message]
2012-01-09 12:04 ` [Qemu-devel] [PATCH 3/3] vhost: improve region filtering Avi Kivity
2012-01-09 13:28   ` Michael S. Tsirkin
2012-01-09 13:27     ` Avi Kivity
2012-01-09 13:32       ` Michael S. Tsirkin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120109132827.GB23401@redhat.com \
    --to=mst@redhat.com \
    --cc=avi@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).