From: "Radim Krčmář" <rkrcmar@redhat.com>
To: qemu-devel@nongnu.org
Cc: Gerd Hoffmann <kraxel@redhat.com>
Subject: [Qemu-devel] [PATCH 1/2] vga: abort instead of shrinking memory
Date: Mon, 16 Feb 2015 22:23:07 +0100 [thread overview]
Message-ID: <1424121788-24560-2-git-send-email-rkrcmar@redhat.com> (raw)
In-Reply-To: <1424121788-24560-1-git-send-email-rkrcmar@redhat.com>
Automatic shrinking of vram_size leads to a segfault, because other
variables depend on being smaller and don't get shrinked.
Implications of shrinking would make the code needlessly complicated;
assert instead.
Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
---
hw/display/vga.c | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/hw/display/vga.c b/hw/display/vga.c
index 9c62fbf48823..a09dd19a6042 100644
--- a/hw/display/vga.c
+++ b/hw/display/vga.c
@@ -2122,13 +2122,9 @@ void vga_common_init(VGACommonState *s, Object *obj, bool global_vmstate)
expand4to8[i] = v;
}
- /* valid range: 1 MB -> 256 MB */
- s->vram_size = 1024 * 1024;
- while (s->vram_size < (s->vram_size_mb << 20) &&
- s->vram_size < (256 << 20)) {
- s->vram_size <<= 1;
- }
- s->vram_size_mb = s->vram_size >> 20;
+ assert(1 <= s->vram_size_mb && s->vram_size_mb <= 256);
+
+ s->vram_size = s->vram_size_mb << 20;
if (!s->vbe_size) {
s->vbe_size = s->vram_size;
}
--
2.3.0
next prev parent reply other threads:[~2015-02-16 21:23 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-16 21:23 [Qemu-devel] [PATCH 0/2] vga: assert to "solve" qxl bug Radim Krčmář
2015-02-16 21:23 ` Radim Krčmář [this message]
2015-02-17 8:00 ` [Qemu-devel] [PATCH 1/2] vga: abort instead of shrinking memory Gerd Hoffmann
2015-02-17 10:29 ` Radim Krčmář
2015-02-17 10:37 ` Gerd Hoffmann
2015-02-17 10:48 ` Radim Krčmář
2015-02-17 10:51 ` Gerd Hoffmann
2015-02-17 11:15 ` Radim Krčmář
2015-02-16 21:23 ` [Qemu-devel] [PATCH 2/2] qxl: surface0 and ram_header should fit into vram Radim Krčmář
2015-02-17 8:02 ` Gerd Hoffmann
2015-02-17 10:31 ` Radim Krčmář
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=1424121788-24560-2-git-send-email-rkrcmar@redhat.com \
--to=rkrcmar@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).