aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2010-05-17 14:06:13 +0200
committerDoug Goldstein <cardoe@gentoo.org>2010-05-26 11:57:34 -0500
commit526d0c99e6dbf386e593e261c726332593cf4033 (patch)
treef967c79c18e702efa2bf7cc252a311856ecf63ce
parentqemu: Report cmdline output if VM dies early (diff)
downloadlibvirt-526d0c99e6dbf386e593e261c726332593cf4033.tar.gz
libvirt-526d0c99e6dbf386e593e261c726332593cf4033.tar.bz2
libvirt-526d0c99e6dbf386e593e261c726332593cf4033.zip
x86ModelHasFeature: avoid NULL-dereference for unmatched CPU "feature"
* src/cpu/cpu_x86.c (x86ModelHasFeature): Do not dereference the pointer returned by x86cpuidFind without first ensuring it is non-NULL.
-rw-r--r--src/cpu/cpu_x86.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
index 633eb69e5..f7473bffb 100644
--- a/src/cpu/cpu_x86.c
+++ b/src/cpu/cpu_x86.c
@@ -614,7 +614,7 @@ x86ModelHasFeature(struct x86_model *model,
cpuid = feature->cpuid + i;
model_cpuid = x86cpuidFind(model->cpuid, model->ncpuid,
cpuid->function);
- if (!x86cpuidMatchMasked(model_cpuid, cpuid))
+ if (!model_cpuid || !x86cpuidMatchMasked(model_cpuid, cpuid))
return false;
}