mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
ppc64Compute: Avoid possible NULL dereference
cpu/cpu_ppc64.c: In function 'ppc64Compute': cpu/cpu_ppc64.c:620:27: error: potential null pointer dereference [-Werror=null-dereference] if (STRNEQ(guest_model->name, host_model->name)) { ~~~~~~~~~~~^~~ cpu/cpu_ppc64.c:620:9: note: in expansion of macro 'STRNEQ' if (STRNEQ(guest_model->name, host_model->name)) { ^~~~~~ cc1: all warnings being treated as errors Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
263a88806c
commit
09258c3c82
@ -600,23 +600,23 @@ ppc64Compute(virCPUDefPtr host,
|
|||||||
case VIR_CPU_MODE_HOST_PASSTHROUGH:
|
case VIR_CPU_MODE_HOST_PASSTHROUGH:
|
||||||
/* host-model and host-passthrough:
|
/* host-model and host-passthrough:
|
||||||
* the guest CPU is the same as the host */
|
* the guest CPU is the same as the host */
|
||||||
if (!(guest_model = ppc64ModelCopy(host_model)))
|
guest_model = ppc64ModelCopy(host_model);
|
||||||
goto cleanup;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VIR_CPU_MODE_CUSTOM:
|
case VIR_CPU_MODE_CUSTOM:
|
||||||
/* custom:
|
/* custom:
|
||||||
* look up guest CPU information */
|
* look up guest CPU information */
|
||||||
if (!(guest_model = ppc64ModelFromCPU(cpu, map)))
|
guest_model = ppc64ModelFromCPU(cpu, map);
|
||||||
goto cleanup;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* Other host CPU information */
|
/* Other host CPU information */
|
||||||
if (!(guest_model = ppc64ModelFromCPU(cpu, map)))
|
guest_model = ppc64ModelFromCPU(cpu, map);
|
||||||
goto cleanup;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!guest_model)
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
if (STRNEQ(guest_model->name, host_model->name)) {
|
if (STRNEQ(guest_model->name, host_model->name)) {
|
||||||
VIR_DEBUG("host CPU model does not match required CPU model %s",
|
VIR_DEBUG("host CPU model does not match required CPU model %s",
|
||||||
guest_model->name);
|
guest_model->name);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user