Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753294AbdHXNkK (ORCPT ); Thu, 24 Aug 2017 09:40:10 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51992 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751242AbdHXNkI (ORCPT ); Thu, 24 Aug 2017 09:40:08 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 8D6DE81DE8 Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=pbonzini@redhat.com Subject: Re: [PATCH v3 2/5] KVM: MMU: check guest CR3 reserved bits based on its physical address width. To: Yu Zhang , kvm@vger.kernel.org Cc: linux-kernel@vger.kernel.org, rkrcmar@redhat.com, tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com, xiaoguangrong@tencent.com, joro@8bytes.org 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> From: Paolo Bonzini Message-ID: <0bce2df3-79ac-599b-19fa-8ebeaff23623@redhat.com> Date: Thu, 24 Aug 2017 15:40:04 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <1503577676-12345-3-git-send-email-yu.c.zhang@linux.intel.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Thu, 24 Aug 2017 13:40:08 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 404 Lines: 18 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? Paolo