cpu_x86: Require <cpuid> within <feature> in CPU map

A feature with no cpuid element is invalid and it should not be silently
treated as a feature with all CPUID bits set to zero.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Jiri Denemark 2019-03-13 10:23:01 +01:00
parent be46f61326
commit dbc04114f3

View File

@ -924,6 +924,13 @@ x86FeatureParse(xmlXPathContextPtr ctxt,
if (n < 0)
goto cleanup;
if (n == 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Missing cpuid for feature %s"),
feature->name);
goto cleanup;
}
for (i = 0; i < n; i++) {
ctxt->node = nodes[i];
if (x86ParseCPUID(ctxt, &cpuid) < 0) {