hw/isa: specify instance_size in isa_superio_type_info
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>
This commit is contained in:
parent
cf5f5f9235
commit
413d0ccb05
@ -185,6 +185,7 @@ static const TypeInfo isa_superio_type_info = {
|
|||||||
.abstract = true,
|
.abstract = true,
|
||||||
.class_size = sizeof(ISASuperIOClass),
|
.class_size = sizeof(ISASuperIOClass),
|
||||||
.class_init = isa_superio_class_init,
|
.class_init = isa_superio_class_init,
|
||||||
|
.instance_size = sizeof(ISASuperIODevice),
|
||||||
};
|
};
|
||||||
|
|
||||||
/* SMS FDC37M817 Super I/O */
|
/* SMS FDC37M817 Super I/O */
|
||||||
@ -201,7 +202,6 @@ static void fdc37m81x_class_init(ObjectClass *klass, void *data)
|
|||||||
static const TypeInfo fdc37m81x_type_info = {
|
static const TypeInfo fdc37m81x_type_info = {
|
||||||
.name = TYPE_FDC37M81X_SUPERIO,
|
.name = TYPE_FDC37M81X_SUPERIO,
|
||||||
.parent = TYPE_ISA_SUPERIO,
|
.parent = TYPE_ISA_SUPERIO,
|
||||||
.instance_size = sizeof(ISASuperIODevice),
|
|
||||||
.class_init = fdc37m81x_class_init,
|
.class_init = fdc37m81x_class_init,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -103,7 +103,6 @@ static void smc37c669_class_init(ObjectClass *klass, void *data)
|
|||||||
static const TypeInfo smc37c669_type_info = {
|
static const TypeInfo smc37c669_type_info = {
|
||||||
.name = TYPE_SMC37C669_SUPERIO,
|
.name = TYPE_SMC37C669_SUPERIO,
|
||||||
.parent = TYPE_ISA_SUPERIO,
|
.parent = TYPE_ISA_SUPERIO,
|
||||||
.instance_size = sizeof(ISASuperIODevice),
|
|
||||||
.class_size = sizeof(ISASuperIOClass),
|
.class_size = sizeof(ISASuperIOClass),
|
||||||
.class_init = smc37c669_class_init,
|
.class_init = smc37c669_class_init,
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user