]> xenbits.xensource.com Git - libvirt.git/commitdiff
x86ModelHasFeature: avoid NULL-dereference for unmatched CPU "feature"
authorJim Meyering <meyering@redhat.com>
Mon, 17 May 2010 12:06:13 +0000 (14:06 +0200)
committerJim Meyering <meyering@redhat.com>
Mon, 17 May 2010 14:50:36 +0000 (16:50 +0200)
* src/cpu/cpu_x86.c (x86ModelHasFeature): Do not dereference the pointer
returned by x86cpuidFind without first ensuring it is non-NULL.

src/cpu/cpu_x86.c

index 633eb69e555d2b7eafa4accca46ca63bfc23ada9..f7473bffb4aca519e7b43d2c94833e5d5d20f2e4 100644 (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;
     }