mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
conf: Report error for unknown shmem ioeventfd value
https://bugzilla.redhat.com/show_bug.cgi?id=1220265 Passing the return value to an enum directly is not safe. Fix this by comparing the true integer result of virTristateSwitchTypeFromString(). Signed-off-by: Luyao Huang <lhuang@redhat.com>
This commit is contained in:
parent
076dd37995
commit
c49b9032a2
@ -10829,13 +10829,17 @@ virDomainShmemDefParseXML(xmlNodePtr node,
|
|||||||
}
|
}
|
||||||
VIR_FREE(tmp);
|
VIR_FREE(tmp);
|
||||||
|
|
||||||
if ((tmp = virXMLPropString(msi, "ioeventfd")) &&
|
if ((tmp = virXMLPropString(msi, "ioeventfd"))) {
|
||||||
(def->msi.ioeventfd = virTristateSwitchTypeFromString(tmp)) <= 0) {
|
int val;
|
||||||
|
|
||||||
|
if ((val = virTristateSwitchTypeFromString(tmp)) <= 0) {
|
||||||
virReportError(VIR_ERR_XML_ERROR,
|
virReportError(VIR_ERR_XML_ERROR,
|
||||||
_("invalid msi ioeventfd setting for shmem: '%s'"),
|
_("invalid msi ioeventfd setting for shmem: '%s'"),
|
||||||
tmp);
|
tmp);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
def->msi.ioeventfd = val;
|
||||||
|
}
|
||||||
VIR_FREE(tmp);
|
VIR_FREE(tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user