[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 18/56] hw/isa: specify instance_size in isa_superio_type_info
From: |
Philippe Mathieu-Daudé |
Subject: |
[PULL 18/56] hw/isa: specify instance_size in isa_superio_type_info |
Date: |
Thu, 15 Feb 2024 18:57:12 +0100 |
From: Paolo Bonzini <pbonzini@redhat.com>
Right now all subclasses of TYPE_ISA_SUPERIO have to specify an instance_size,
because the ISASuperIODevice struct adds fields to ISADevice but the type does
not include the increased instance size. Failure to do so results in an access
past the bounds of struct ISADevice as soon as isa_superio_realize is called.
Fix this by specifying the instance_size already in the superclass.
Fixes: 4c3119a6e3 ("hw/isa/superio: Factor out the parallel code from
pc87312.c")
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Bernhard Beschow <shentey@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-ID: <20240213155005.109954-6-pbonzini@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/isa/isa-superio.c | 2 +-
hw/isa/smc37c669-superio.c | 1 -
2 files changed, 1 insertion(+), 2 deletions(-)
diff --git a/hw/isa/isa-superio.c b/hw/isa/isa-superio.c
index 7dbfc374da..d85f22db1a 100644
--- a/hw/isa/isa-superio.c
+++ b/hw/isa/isa-superio.c
@@ -185,6 +185,7 @@ static const TypeInfo isa_superio_type_info = {
.abstract = true,
.class_size = sizeof(ISASuperIOClass),
.class_init = isa_superio_class_init,
+ .instance_size = sizeof(ISASuperIODevice),
};
/* SMS FDC37M817 Super I/O */
@@ -201,7 +202,6 @@ static void fdc37m81x_class_init(ObjectClass *klass, void
*data)
static const TypeInfo fdc37m81x_type_info = {
.name = TYPE_FDC37M81X_SUPERIO,
.parent = TYPE_ISA_SUPERIO,
- .instance_size = sizeof(ISASuperIODevice),
.class_init = fdc37m81x_class_init,
};
diff --git a/hw/isa/smc37c669-superio.c b/hw/isa/smc37c669-superio.c
index 18287741cb..9e59dc1603 100644
--- a/hw/isa/smc37c669-superio.c
+++ b/hw/isa/smc37c669-superio.c
@@ -103,7 +103,6 @@ static void smc37c669_class_init(ObjectClass *klass, void
*data)
static const TypeInfo smc37c669_type_info = {
.name = TYPE_SMC37C669_SUPERIO,
.parent = TYPE_ISA_SUPERIO,
- .instance_size = sizeof(ISASuperIODevice),
.class_size = sizeof(ISASuperIOClass),
.class_init = smc37c669_class_init,
};
--
2.41.0
- [PULL 08/56] hw/misc/mips_itu: Remove MIPSITUState::cpu0 field, (continued)
- [PULL 08/56] hw/misc/mips_itu: Remove MIPSITUState::cpu0 field, Philippe Mathieu-Daudé, 2024/02/15
- [PULL 09/56] hw/misc/mips_itu: Remove MIPSITUState::saar field, Philippe Mathieu-Daudé, 2024/02/15
- [PULL 10/56] target/mips: Remove unused mips_def_t::SAARP field, Philippe Mathieu-Daudé, 2024/02/15
- [PULL 11/56] target/mips: Remove CPUMIPSState::CP0_SAAR[2] field, Philippe Mathieu-Daudé, 2024/02/15
- [PULL 12/56] target/mips: Remove helpers accessing SAARI register, Philippe Mathieu-Daudé, 2024/02/15
- [PULL 13/56] target/mips: Remove CPUMIPSState::CP0_SAARI field, Philippe Mathieu-Daudé, 2024/02/15
- [PULL 14/56] target/mips: Remove the unused DisasContext::saar field, Philippe Mathieu-Daudé, 2024/02/15
- [PULL 15/56] hw/isa: clean up Kconfig selections for ISA_SUPERIO, Philippe Mathieu-Daudé, 2024/02/15
- [PULL 17/56] hw/isa: fix ISA_SUPERIO dependencies, Philippe Mathieu-Daudé, 2024/02/15
- [PULL 16/56] hw/mips/Kconfig: Remove ISA dependencies from MIPSsim board, Philippe Mathieu-Daudé, 2024/02/15
- [PULL 18/56] hw/isa: specify instance_size in isa_superio_type_info,
Philippe Mathieu-Daudé <=
- [PULL 19/56] hw/isa: extract FDC37M81X to a separate file, Philippe Mathieu-Daudé, 2024/02/15
- [PULL 20/56] hw/rx/rx62n: Reduce inclusion of 'qemu/units.h', Philippe Mathieu-Daudé, 2024/02/15
- [PULL 21/56] hw/rx/rx62n: Only call qdev_get_gpio_in() when necessary, Philippe Mathieu-Daudé, 2024/02/15
- [PULL 22/56] hw/i386/q35: Realize LPC PCI function before accessing it, Philippe Mathieu-Daudé, 2024/02/15
- [PULL 23/56] hw/ppc/prep: Realize ISA bridge before accessing it, Philippe Mathieu-Daudé, 2024/02/15
- [PULL 24/56] hw/misc/macio: Realize IDE controller before accessing it, Philippe Mathieu-Daudé, 2024/02/15
- [PULL 25/56] hw/sh4/r2d: Realize IDE controller before accessing it, Philippe Mathieu-Daudé, 2024/02/15
- [PULL 26/56] hw/dma: Pass parent object to i8257_dma_init(), Philippe Mathieu-Daudé, 2024/02/15
- [PULL 28/56] hw/sparc64/cpu: Initialize GPIO before realizing CPU devices, Philippe Mathieu-Daudé, 2024/02/15
- [PULL 27/56] hw/sparc/sun4m: Realize DMA controller before accessing it, Philippe Mathieu-Daudé, 2024/02/15