summaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorLai Jiangshan <jiangshan.ljs@antgroup.com>2022-03-11 15:03:43 +0800
committerPaolo Bonzini <pbonzini@redhat.com>2022-04-02 05:34:43 -0400
commit8873c1434fac436f68ac2221676bb148e8fdffa2 (patch)
treea87c7509fe827f13836e7db8fe3ec9326dbdad90 /arch
parent94b4a2f1745fe7aaa551d3d6a9424b6616587c72 (diff)
downloadlinux-stable-8873c1434fac436f68ac2221676bb148e8fdffa2.tar.gz
linux-stable-8873c1434fac436f68ac2221676bb148e8fdffa2.tar.bz2
linux-stable-8873c1434fac436f68ac2221676bb148e8fdffa2.zip
KVM: X86: Rename variable smap to not_smap in permission_fault()
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>
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/kvm/mmu.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/arch/x86/kvm/mmu.h b/arch/x86/kvm/mmu.h
index 74efeaefa8f8..24d94f6d378d 100644
--- a/arch/x86/kvm/mmu.h
+++ b/arch/x86/kvm/mmu.h
@@ -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;