qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Alon Levy <alevy@redhat.com>
To: qemu-devel@nongnu.org
Cc: kraxel@redhat.com
Subject: [Qemu-devel] [PATCH 2/3] qxl: refuse to create primary larger then fb size
Date: Mon, 11 Jun 2012 09:24:00 +0300	[thread overview]
Message-ID: <1339395841-31413-3-git-send-email-alevy@redhat.com> (raw)
In-Reply-To: <1339395841-31413-1-git-send-email-alevy@redhat.com>

Signed-off-by: Alon Levy <alevy@redhat.com>
---
 hw/qxl.c |   10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/hw/qxl.c b/hw/qxl.c
index a9b4fd1..6596856 100644
--- a/hw/qxl.c
+++ b/hw/qxl.c
@@ -1204,6 +1204,16 @@ static void qxl_create_guest_primary(PCIQXLDevice *qxl, int loadvm,
 {
     QXLDevSurfaceCreate surface;
     QXLSurfaceCreate *sc = &qxl->guest_primary.surface;
+    int size;
+    int requested_height = le32_to_cpu(sc->height);
+    int requested_stride = le32_to_cpu(sc->stride);
+
+    size = abs(requested_stride) * requested_height;
+    if (size > qxl->fb_size) {
+        qxl_set_guest_bug(qxl, "%s: requested primary larger then framebuffer"
+                               " size", __func__);
+        return;
+    }
 
     if (qxl->mode == QXL_MODE_NATIVE) {
         qxl_set_guest_bug(qxl, "%s: nop since already in QXL_MODE_NATIVE",
-- 
1.7.10.1

  parent reply	other threads:[~2012-06-11  6:24 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-11  6:23 [Qemu-devel] [PATCH 0/3] qxl fb size and async fix Alon Levy
2012-06-11  6:23 ` [Qemu-devel] [PATCH 1/3] qxl: add fb_size_mb and fb_size Alon Levy
2012-06-11  7:42   ` Gerd Hoffmann
2012-06-11  8:26     ` Alon Levy
2012-06-11  8:29       ` Gerd Hoffmann
2012-06-11  8:35         ` Alon Levy
2012-06-11  9:33         ` Alon Levy
2012-06-11 10:18           ` Gerd Hoffmann
2012-06-11 10:23             ` Alon Levy
2012-06-11  6:24 ` Alon Levy [this message]
2012-06-11  6:24 ` [Qemu-devel] [PATCH 3/3] qxl: reset current_async on qxl_soft_reset Alon Levy

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=1339395841-31413-3-git-send-email-alevy@redhat.com \
    --to=alevy@redhat.com \
    --cc=kraxel@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).