mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 12:35:17 +00:00
qemu: Fix switch() statements for virDomainIOMMUModel
Ensure unexpected values are dealt with correctly, that is by invoking virReportEnumRangeError() and immediately returning a negative value to the caller. Signed-off-by: Andrea Bolognani <abologna@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
571cb9db30
commit
dfa631b55a
@ -6961,8 +6961,12 @@ qemuBuildIOMMUCommandLine(virCommandPtr cmd,
|
||||
virBufferAsprintf(&opts, ",device-iotlb=%s",
|
||||
virTristateSwitchTypeToString(iommu->iotlb));
|
||||
}
|
||||
case VIR_DOMAIN_IOMMU_MODEL_LAST:
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_IOMMU_MODEL_LAST:
|
||||
default:
|
||||
virReportEnumRangeError(virDomainIOMMUModel, iommu->model);
|
||||
return -1;
|
||||
}
|
||||
virCommandAddArg(cmd, "-device");
|
||||
virCommandAddArgBuffer(cmd, &opts);
|
||||
@ -7609,7 +7613,9 @@ qemuBuildMachineCommandLine(virCommandPtr cmd,
|
||||
virBufferAddLit(&buf, ",iommu=on");
|
||||
break;
|
||||
case VIR_DOMAIN_IOMMU_MODEL_LAST:
|
||||
break;
|
||||
default:
|
||||
virReportEnumRangeError(virDomainIOMMUModel, def->iommu->model);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6138,6 +6138,7 @@ qemuDomainDeviceDefValidateIOMMU(const virDomainIOMMUDef *iommu,
|
||||
case VIR_DOMAIN_IOMMU_MODEL_LAST:
|
||||
default:
|
||||
virReportEnumRangeError(virDomainIOMMUModel, iommu->model);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user