mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-26 14:03:49 +03:00
virDomainControllerDefParseXML: Fix broken error reporting when parsing 'index'
The code attempted to report an error if the user added the 'index' attribute to the 'target' element, but neglected to actually return an error code. Fix it by using the VIR_XML_PROP_NONNEGATIVE flag for virXMLPropInt which refuses user passed negative numbers. Fixes: 020dd80ecbd Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
c91d8fdef3
commit
318e5e3bac
@ -8233,15 +8233,10 @@ virDomainControllerDefParseXML(virDomainXMLOption *xmlopt,
|
||||
&def->opts.pciopts.hotplug) < 0)
|
||||
return NULL;
|
||||
|
||||
if ((rc = virXMLPropInt(targetNodes[0], "index", 0, VIR_XML_PROP_NONE,
|
||||
&def->opts.pciopts.targetIndex,
|
||||
def->opts.pciopts.targetIndex)) < 0)
|
||||
if (virXMLPropInt(targetNodes[0], "index", 0, VIR_XML_PROP_NONNEGATIVE,
|
||||
&def->opts.pciopts.targetIndex,
|
||||
def->opts.pciopts.targetIndex) < 0)
|
||||
return NULL;
|
||||
|
||||
if ((rc == 1) && def->opts.pciopts.targetIndex == -1)
|
||||
virReportError(VIR_ERR_XML_ERROR,
|
||||
_("Invalid target index '%i' in PCI controller"),
|
||||
def->opts.pciopts.targetIndex);
|
||||
}
|
||||
} else if (ntargetNodes > 1) {
|
||||
virReportError(VIR_ERR_XML_ERROR, "%s",
|
||||
|
Loading…
x
Reference in New Issue
Block a user