mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 18:50:05 +01:00
x86/levelling: Avoid NULL pointer dereference
Coverity points out that next is indeed NULL at times. Only try to read the
.cpuid_faulting field when we sure that next isn't NULL.
Fixes e7a370733b "x86: replace arch_vcpu::cpuid_faulting with msr_vcpu_policy"
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
This commit is contained in:
1 parent
55b33293c3
commit
d73e68c08f
1 file changed
+1
-2
@@ -156,7 +156,6 @@ static void intel_ctxt_switch_levelling(const struct vcpu *next)
|
||||
struct cpuidmasks *these_masks = &this_cpu(cpuidmasks);
|
||||
const struct domain *nextd = next ? next->domain : NULL;
|
||||
const struct cpuidmasks *masks;
|
||||
const struct msr_vcpu_policy *vp = next->arch.msr;
|
||||
|
||||
if (cpu_has_cpuid_faulting) {
|
||||
/*
|
||||
@@ -177,7 +176,7 @@ static void intel_ctxt_switch_levelling(const struct vcpu *next)
|
||||
*/
|
||||
set_cpuid_faulting(nextd && !is_control_domain(nextd) &&
|
||||
(is_pv_domain(nextd) ||
|
||||
vp->misc_features_enables.cpuid_faulting));
|
||||
next->arch.msr->misc_features_enables.cpuid_faulting));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||