From mboxrd@z Thu Jan 1 00:00:00 1970 From: Yu Zhang Subject: Re: [PATCH v3 2/5] KVM: MMU: check guest CR3 reserved bits based on its physical address width. Date: Thu, 24 Aug 2017 23:23:05 +0800 Message-ID: References: <1503577676-12345-1-git-send-email-yu.c.zhang@linux.intel.com> <1503577676-12345-3-git-send-email-yu.c.zhang@linux.intel.com> <0bce2df3-79ac-599b-19fa-8ebeaff23623@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Cc: linux-kernel@vger.kernel.org, rkrcmar@redhat.com, tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com, xiaoguangrong@tencent.com, joro@8bytes.org To: Paolo Bonzini , kvm@vger.kernel.org Return-path: In-Reply-To: <0bce2df3-79ac-599b-19fa-8ebeaff23623@redhat.com> Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org List-Id: kvm.vger.kernel.org On 8/24/2017 9:40 PM, Paolo Bonzini wrote: > On 24/08/2017 14:27, Yu Zhang wrote: >> diff --git a/arch/x86/kvm/mmu.h b/arch/x86/kvm/mmu.h >> index 3ed6192..67e7ec2 100644 >> --- a/arch/x86/kvm/mmu.h >> +++ b/arch/x86/kvm/mmu.h >> @@ -48,6 +48,9 @@ >> >> static inline u64 rsvd_bits(int s, int e) >> { >> + if (e < s) >> + return 0; >> + >> return ((1ULL << (e - s + 1)) - 1) << s; >> } > e = s - 1 is already supported; why do you need e <= s - 2? Sorry? I do not quite understand. When will e = s - 1? Thanks Yu > Paolo >