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.
This commit is contained in:
Jim Meyering 2010-05-17 14:06:13 +02:00
parent 83be64034a
commit 258d59cff9

View File

@ -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;
}