From: Gleb Natapov Date: Wed, 12 Dec 2012 17:10:49 +0000 (+0200) Subject: KVM: VMX: cleanup rmode_segment_valid() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=07f42f5f25dc214a33214159fc8b62b984b713eb;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git KVM: VMX: cleanup rmode_segment_valid() Set segment fields explicitly instead of using binary operations. No behaviour changes. Reviewed-by: Marcelo Tosatti Signed-off-by: Gleb Natapov --- diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index b3101e368079..265fdd37b240 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -3380,13 +3380,16 @@ static bool rmode_segment_valid(struct kvm_vcpu *vcpu, int seg) u32 ar; vmx_get_segment(vcpu, &var, seg); + var.dpl = 0x3; + var.g = 0; + var.db = 0; ar = vmx_segment_access_rights(&var); if (var.base != (var.selector << 4)) return false; if (var.limit < 0xffff) return false; - if (((ar | (3 << AR_DPL_SHIFT)) & ~(AR_G_MASK | AR_DB_MASK)) != 0xf3) + if (ar != 0xf3) return false; return true;