aboutsummaryrefslogtreecommitdiff
path: root/hw/isa
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2024-01-29 14:32:38 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2024-02-16 13:56:08 +0100
commit41514c0a77346da43994bc98f43c34f95cf2e0d3 (patch)
tree47a9c5f3614dda3fc58da1fa3fef5243c5c332dc /hw/isa
parentdeac624f221bf8000c19e138547832ac0144c610 (diff)
isa-superio: validate floppy.count value
Ensure that the value is valid; it can only be zero or one. And never create a floppy disk controller if it is zero. Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'hw/isa')
-rw-r--r--hw/isa/isa-superio.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/hw/isa/isa-superio.c b/hw/isa/isa-superio.c
index 7dbfc374da..e06a548c68 100644
--- a/hw/isa/isa-superio.c
+++ b/hw/isa/isa-superio.c
@@ -116,7 +116,9 @@ static void isa_superio_realize(DeviceState *dev, Error **errp)
}
/* Floppy disc */
- if (!k->floppy.is_enabled || k->floppy.is_enabled(sio, 0)) {
+ assert(k->floppy.count <= 1);
+ if (k->floppy.count &&
+ (!k->floppy.is_enabled || k->floppy.is_enabled(sio, 0))) {
isa = isa_new(TYPE_ISA_FDC);
d = DEVICE(isa);
if (k->floppy.get_iobase) {