* [PATCH] isa-superio: validate floppy.count value
@ 2024-01-29 13:32 Paolo Bonzini
2024-01-29 13:34 ` Philippe Mathieu-Daudé
0 siblings, 1 reply; 2+ messages in thread
From: Paolo Bonzini @ 2024-01-29 13:32 UTC (permalink / raw)
To: qemu-devel
Ensure that the value is valid; it can only be zero or one.
And never create a floppy disk controller if it is zero.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
hw/isa/isa-superio.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/hw/isa/isa-superio.c b/hw/isa/isa-superio.c
index 80e0c34652e..34df335598c 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) {
--
2.43.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-01-29 14:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-29 13:32 [PATCH] isa-superio: validate floppy.count value Paolo Bonzini
2024-01-29 13:34 ` Philippe Mathieu-Daudé
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).