qemuDomainGetSCSIControllerModel() can return -1 on failure,
but qemuDomainFindOrCreateSCSIDiskController() didn't implement
any handling for this scenario.
Signed-off-by: Andrea Bolognani <abologna(a)redhat.com>
---
src/qemu/qemu_hotplug.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 0e45bd53e1..afb720fc0b 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -881,6 +881,11 @@ qemuDomainFindOrCreateSCSIDiskController(virDomainObj *vm,
else
cont->model = model;
+ if (cont->model < 0) {
+ VIR_FREE(cont);
+ return NULL;
+ }
+
VIR_INFO("No SCSI controller present, hotplugging one model=%s",
virDomainControllerModelSCSITypeToString(cont->model));
if (qemuDomainAttachControllerDevice(vm, cont) < 0) {
--
2.43.0