From: Jim Meyering Date: Mon, 17 May 2010 12:06:13 +0000 (+0200) Subject: x86ModelHasFeature: avoid NULL-dereference for unmatched CPU "feature" X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=258d59cff9e41771a5c1dcafa764cac776021c59;p=libvirt.git 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. --- diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index 633eb69e55..f7473bffb4 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; }