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>
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) {