kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pekka Enberg <penberg@kernel.org>
To: Sasha Levin <levinsasha928@gmail.com>
Cc: mingo@elte.hu, asias.hejun@gmail.com, prasadjoshi124@gmail.com,
	avi@redhat.com, gorcunov@gmail.com, kvm@vger.kernel.org
Subject: Re: [PATCH 2/2] kvm tools: Prevent PFN wraparound
Date: Wed, 11 May 2011 00:09:46 +0300	[thread overview]
Message-ID: <BANLkTiknss3nYGnkWcw3_Wq7hfA0DiTZOA@mail.gmail.com> (raw)
In-Reply-To: <1305061513-28360-2-git-send-email-levinsasha928@gmail.com>

On Wed, May 11, 2011 at 12:05 AM, Sasha Levin <levinsasha928@gmail.com> wrote:
> queue->pfn may be used to point at addresses larger
> than 32 bit.
> Prevent a wraparound when shifting it left.
>
> Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
> ---
>  tools/kvm/virtio/blk.c     |    2 +-
>  tools/kvm/virtio/console.c |    2 +-
>  tools/kvm/virtio/net.c     |    2 +-
>  tools/kvm/virtio/rng.c     |    2 +-
>  4 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/tools/kvm/virtio/blk.c b/tools/kvm/virtio/blk.c
> index 12c7029..b7fea79 100644
> --- a/tools/kvm/virtio/blk.c
> +++ b/tools/kvm/virtio/blk.c
> @@ -197,7 +197,7 @@ static bool virtio_blk_pci_io_out(struct kvm *self, u16 port, void *data, int si
>
>                queue                   = &bdev->vqs[bdev->queue_selector];
>                queue->pfn              = ioport__read32(data);
> -               p                       = guest_flat_to_host(self, queue->pfn << 12);
> +               p                       = guest_flat_to_host(self, (u64)queue->pfn << 12);

Lets make a guest_pfn_to_host() helper for this instead.

  reply	other threads:[~2011-05-10 21:09 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-10 21:05 [PATCH 1/2] kvm tools: Add memory gap for larger RAM sizes Sasha Levin
2011-05-10 21:05 ` [PATCH 2/2] kvm tools: Prevent PFN wraparound Sasha Levin
2011-05-10 21:09   ` Pekka Enberg [this message]
2011-05-11  5:37 ` [PATCH 1/2] kvm tools: Add memory gap for larger RAM sizes Pekka Enberg
2011-05-11  6:21   ` Sasha Levin
2011-05-11  6:26     ` Pekka Enberg
2011-05-11  7:10       ` Ingo Molnar
2011-05-11  8:30   ` Avi Kivity
2011-05-11  8:44     ` Ingo Molnar
2011-05-11  9:06       ` Avi Kivity
2011-05-11  9:28         ` Pekka Enberg

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=BANLkTiknss3nYGnkWcw3_Wq7hfA0DiTZOA@mail.gmail.com \
    --to=penberg@kernel.org \
    --cc=asias.hejun@gmail.com \
    --cc=avi@redhat.com \
    --cc=gorcunov@gmail.com \
    --cc=kvm@vger.kernel.org \
    --cc=levinsasha928@gmail.com \
    --cc=mingo@elte.hu \
    --cc=prasadjoshi124@gmail.com \
    /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).