KVM: X86: Rename variable smap to not_smap in permission_fault()
authorLai Jiangshan <jiangshan.ljs@antgroup.com>
Fri, 11 Mar 2022 07:03:43 +0000 (15:03 +0800)
committerPaolo Bonzini <pbonzini@redhat.com>
Sat, 2 Apr 2022 09:34:43 +0000 (05:34 -0400)
Comments above the variable says the bit is set when SMAP is overridden
or the same meaning in update_permission_bitmask(): it is not subjected
to SMAP restriction.

Renaming it to reflect the negative implication and make the code better
readability.

Signed-off-by: Lai Jiangshan <jiangshan.ljs@antgroup.com>
Message-Id: <20220311070346.45023-4-jiangshanlai@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/mmu.h

index 74efeae..24d94f6 100644 (file)
@@ -234,9 +234,9 @@ static inline u8 permission_fault(struct kvm_vcpu *vcpu, struct kvm_mmu *mmu,
         * but it will be one in index if SMAP checks are being overridden.
         * It is important to keep this branchless.
         */
-       unsigned long smap = (cpl - 3) & (rflags & X86_EFLAGS_AC);
+       unsigned long not_smap = (cpl - 3) & (rflags & X86_EFLAGS_AC);
        int index = (pfec >> 1) +
-                   (smap >> (X86_EFLAGS_AC_BIT - PFERR_RSVD_BIT + 1));
+                   (not_smap >> (X86_EFLAGS_AC_BIT - PFERR_RSVD_BIT + 1));
        bool fault = (mmu->permissions[index] >> pte_access) & 1;
        u32 errcode = PFERR_PRESENT_MASK;