mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
cpu_x86: Don't check return value of x86ModelCopy
Thanks to glib allocation functions which abort on OOM the function cannot ever return NULL. Signed-off-by: Jiri Denemark <jdenemar@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
22bded201f
commit
70f3041d39
@ -1287,9 +1287,6 @@ x86ModelFromCPU(const virCPUDef *cpu,
|
|||||||
model = g_new0(virCPUx86Model, 1);
|
model = g_new0(virCPUx86Model, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!model)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
for (i = 0; i < cpu->nfeatures; i++) {
|
for (i = 0; i < cpu->nfeatures; i++) {
|
||||||
virCPUx86FeaturePtr feature;
|
virCPUx86FeaturePtr feature;
|
||||||
virCPUFeaturePolicy fpol;
|
virCPUFeaturePolicy fpol;
|
||||||
@ -1869,9 +1866,7 @@ x86Compute(virCPUDefPtr host,
|
|||||||
return VIR_CPU_COMPARE_INCOMPATIBLE;
|
return VIR_CPU_COMPARE_INCOMPATIBLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(diff = x86ModelCopy(host_model)))
|
diff = x86ModelCopy(host_model);
|
||||||
return VIR_CPU_COMPARE_ERROR;
|
|
||||||
|
|
||||||
x86DataSubtract(&diff->data, &cpu_optional->data);
|
x86DataSubtract(&diff->data, &cpu_optional->data);
|
||||||
x86DataSubtract(&diff->data, &cpu_require->data);
|
x86DataSubtract(&diff->data, &cpu_require->data);
|
||||||
x86DataSubtract(&diff->data, &cpu_disable->data);
|
x86DataSubtract(&diff->data, &cpu_disable->data);
|
||||||
@ -1892,8 +1887,7 @@ x86Compute(virCPUDefPtr host,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (guest) {
|
if (guest) {
|
||||||
if (!(guest_model = x86ModelCopy(host_model)))
|
guest_model = x86ModelCopy(host_model);
|
||||||
return VIR_CPU_COMPARE_ERROR;
|
|
||||||
|
|
||||||
if (cpu->vendor && host_model->vendor &&
|
if (cpu->vendor && host_model->vendor &&
|
||||||
virCPUx86DataAddItem(&guest_model->data,
|
virCPUx86DataAddItem(&guest_model->data,
|
||||||
@ -3131,8 +3125,8 @@ virCPUx86ExpandFeatures(virCPUDefPtr cpu)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(model = x86ModelCopy(model)) ||
|
model = x86ModelCopy(model);
|
||||||
x86DataToCPUFeatures(expanded, host ? -1 : VIR_CPU_FEATURE_REQUIRE,
|
if (x86DataToCPUFeatures(expanded, host ? -1 : VIR_CPU_FEATURE_REQUIRE,
|
||||||
&model->data, map) < 0)
|
&model->data, map) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user