From 450ead742ae119b9862c3385b9a27060c4364483 Mon Sep 17 00:00:00 2001 From: Peter Maydell Date: Wed, 29 Aug 2012 08:52:37 +0100 Subject: hw/arm_gic.c: Define .class_size in arm_gic_info TypeInfo 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 Signed-off-by: Peter Maydell Signed-off-by: Anthony Liguori (cherry picked from commit 998a74bcda7f3297813732ddc2f28ffe5a12e37a) - ARMGICClass isn't in 1.1, set class size to SysBusDeviceClass instead Signed-off-by: Michael Roth --- hw/arm_gic.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/arm_gic.c b/hw/arm_gic.c index 72298b4b4..ab3b87b14 100644 --- a/hw/arm_gic.c +++ b/hw/arm_gic.c @@ -955,6 +955,7 @@ static TypeInfo arm_gic_info = { .parent = TYPE_SYS_BUS_DEVICE, .instance_size = sizeof(gic_state), .class_init = arm_gic_class_init, + .class_size = sizeof(SysBusDeviceClass), }; static void arm_gic_register_types(void) -- cgit v1.2.3