public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Konstantin Khlebnikov <koct9i@gmail.com>
To: Pekka Enberg <penberg@kernel.org>, Sasha Levin <sasha.levin@oracle.com>
Cc: kvm@vger.kernel.org
Subject: [PATCH] kvm tools: balloon: fix overflow in PFN to address conversion
Date: Wed, 20 Aug 2014 18:37:34 +0400	[thread overview]
Message-ID: <20140820143734.3909.97343.stgit@buzz> (raw)

Fix trivial overflow of u32 value

Signed-off-by: Konstantin Khlebnikov <koct9i@gmail.com>
---
 tools/kvm/virtio/balloon.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/kvm/virtio/balloon.c b/tools/kvm/virtio/balloon.c
index f7dfb0b..84c4bb0 100644
--- a/tools/kvm/virtio/balloon.c
+++ b/tools/kvm/virtio/balloon.c
@@ -64,7 +64,7 @@ static bool virtio_bln_do_io_request(struct kvm *kvm, struct bln_dev *bdev, stru
 	for (i = 0 ; i < len ; i++) {
 		void *guest_ptr;
 
-		guest_ptr = guest_flat_to_host(kvm, ptrs[i] << VIRTIO_BALLOON_PFN_SHIFT);
+		guest_ptr = guest_flat_to_host(kvm, (u64)ptrs[i] << VIRTIO_BALLOON_PFN_SHIFT);
 		if (queue == &bdev->vqs[VIRTIO_BLN_INFLATE]) {
 			madvise(guest_ptr, 1 << VIRTIO_BALLOON_PFN_SHIFT, MADV_DONTNEED);
 			bdev->config.actual++;


                 reply	other threads:[~2014-08-20 14:37 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20140820143734.3909.97343.stgit@buzz \
    --to=koct9i@gmail.com \
    --cc=kvm@vger.kernel.org \
    --cc=penberg@kernel.org \
    --cc=sasha.levin@oracle.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