diff options
author | Eduardo Habkost <ehabkost@redhat.com> | 2020-08-28 10:02:47 +0100 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2020-08-28 10:02:47 +0100 |
commit | 512c65e62e9e1ae9863ae5a8493e9fad9dbf00e7 (patch) | |
tree | 2c28bce55dc62a3581a54144b882830e25a9b01f /hw/arm | |
parent | 55d35c881924ce5a8ce410210865e47553762847 (diff) | |
download | qemu-512c65e62e9e1ae9863ae5a8493e9fad9dbf00e7.zip qemu-512c65e62e9e1ae9863ae5a8493e9fad9dbf00e7.tar.gz qemu-512c65e62e9e1ae9863ae5a8493e9fad9dbf00e7.tar.bz2 |
armsse: Define ARMSSEClass correctly
TYPE_ARM_SSE is a TYPE_SYS_BUS_DEVICE subclass, but
ARMSSEClass::parent_class is declared as DeviceClass.
It never caused any problems by pure luck:
We were not setting class_size for TYPE_ARM_SSE, so class_size of
TYPE_SYS_BUS_DEVICE was being used (sizeof(SysBusDeviceClass)).
This made the system allocate enough memory for TYPE_ARM_SSE
devices even though ARMSSEClass was too small for a sysbus
device.
Additionally, the ARMSSEClass::info field ended up at the same
offset as SysBusDeviceClass::explicit_ofw_unit_address. This
would make sysbus_get_fw_dev_path() crash for the device.
Luckily, sysbus_get_fw_dev_path() never gets called for
TYPE_ARM_SSE devices, because qdev_get_fw_dev_path() is only used
by the boot device code, and TYPE_ARM_SSE devices don't appear at
the fw_boot_order list.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Message-id: 20200826181006.4097163-1-ehabkost@redhat.com
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/arm')
-rw-r--r-- | hw/arm/armsse.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/hw/arm/armsse.c b/hw/arm/armsse.c index dcbff9b..6381bbd 100644 --- a/hw/arm/armsse.c +++ b/hw/arm/armsse.c @@ -1160,6 +1160,7 @@ static const TypeInfo armsse_info = { .name = TYPE_ARMSSE, .parent = TYPE_SYS_BUS_DEVICE, .instance_size = sizeof(ARMSSE), + .class_size = sizeof(ARMSSEClass), .instance_init = armsse_init, .abstract = true, .interfaces = (InterfaceInfo[]) { |