From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Cc: Stefan Weil <sw@weilnetz.de>,
Anthony Liguori <aliguori@us.ibm.com>,
patches@linaro.org
Subject: [Qemu-devel] [PATCH for-1.2] hw/arm_gic.c: Define .class_size in arm_gic_info TypeInfo
Date: Wed, 29 Aug 2012 08:52:37 +0100 [thread overview]
Message-ID: <1346226757-24968-1-git-send-email-peter.maydell@linaro.org> (raw)
Add the missing .class_size definition to the arm_gic_info TypeInfo.
This fixes the memory corruption and possible segfault that otherwise
results when the class struct is allocated at too small a size and
the class init function writes off the end of it.
Reported-by: Adam Lackorzynski <adam@os.inf.tu-dresden.de>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
Oops. I suspect this only crashes on 32 bit hosts because the class
is only one field larger than its subclass, so on 64 bit systems
we are probably only overwriting padding rather than anything
important. For 1.2 since it fixes a segfault.
hw/arm_gic.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/hw/arm_gic.c b/hw/arm_gic.c
index 186ac66..55871fa 100644
--- a/hw/arm_gic.c
+++ b/hw/arm_gic.c
@@ -703,6 +703,7 @@ static TypeInfo arm_gic_info = {
.parent = TYPE_ARM_GIC_COMMON,
.instance_size = sizeof(gic_state),
.class_init = arm_gic_class_init,
+ .class_size = sizeof(ARMGICClass),
};
static void arm_gic_register_types(void)
--
1.7.5.4
next reply other threads:[~2012-08-29 7:52 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-29 7:52 Peter Maydell [this message]
2012-08-29 18:57 ` [Qemu-devel] [PATCH for-1.2] hw/arm_gic.c: Define .class_size in arm_gic_info TypeInfo Stefan Weil
2012-08-30 13:06 ` Andreas Färber
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=1346226757-24968-1-git-send-email-peter.maydell@linaro.org \
--to=peter.maydell@linaro.org \
--cc=aliguori@us.ibm.com \
--cc=patches@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=sw@weilnetz.de \
/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).