提交 ba8ba247 编写于 作者: J Jiri Denemark

cpu: Fix loading PowerPC vendor from cpu_map.xml

When ppcVendorLoad fails to parse the vendor element for whatever
reason, it is supposed to ignore it and return 0 rather than -1. The
patch also removes PowerPC vendor string from the XML as it is not
actually used for anything.
上级 70349cb9
......@@ -585,9 +585,10 @@
</model>
</arch>
<arch name='ppc64'>
<!-- vendor definitions -->
<vendor name='IBM' string='PowerPC'/>
<!-- IBM-based CPU models -->
<!-- vendor definitions -->
<vendor name='IBM'/>
<!-- IBM-based CPU models -->
<model name='POWER7'>
<vendor name='IBM'/>
</model>
......
......@@ -203,11 +203,11 @@ ppcVendorLoad(xmlXPathContextPtr ctxt,
struct ppc_map *map)
{
struct ppc_vendor *vendor = NULL;
char *string = NULL;
int ret = -1;
if (VIR_ALLOC(vendor) < 0)
goto no_memory;
if (VIR_ALLOC(vendor) < 0) {
virReportOOMError();
return -1;
}
vendor->name = virXPathString("string(@name)", ctxt);
if (!vendor->name) {
......@@ -222,31 +222,19 @@ ppcVendorLoad(xmlXPathContextPtr ctxt,
goto ignore;
}
string = virXPathString("string(@string)", ctxt);
if (!string) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Missing vendor string for CPU vendor %s"), vendor->name);
goto ignore;
}
if (!map->vendors)
if (!map->vendors) {
map->vendors = vendor;
else {
} else {
vendor->next = map->vendors;
map->vendors = vendor;
}
ret = 0;
out:
VIR_FREE(string);
return ret;
no_memory:
virReportOOMError();
cleanup:
return 0;
ignore:
ppcVendorFree(vendor);
goto out;
goto cleanup;
}
static int
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册