From mboxrd@z Thu Jan 1 00:00:00 1970 From: Keir Fraser Subject: Re: [PATCH] x86/MTRR: fix range check in mtrr_add_page() Date: Tue, 13 Aug 2013 18:34:44 +0100 Message-ID: References: <520A709D02000078000EB977@nat28.tlf.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1V9IUd-0002hX-2w for xen-devel@lists.xenproject.org; Tue, 13 Aug 2013 17:34:51 +0000 Received: by mail-ea0-f181.google.com with SMTP id d10so4281354eaj.26 for ; Tue, 13 Aug 2013 10:34:49 -0700 (PDT) In-Reply-To: <520A709D02000078000EB977@nat28.tlf.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Jan Beulich , xen-devel List-Id: xen-devel@lists.xenproject.org On 13/08/2013 16:45, "Jan Beulich" wrote: > Extracted from Yinghai Lu's Linux commit d5c78673 ("x86: Fix /proc/mtrr > with base/size more than 44bits"). > > Signed-off-by: Jan Beulich Acked-by: Keir Fraser > --- a/xen/arch/x86/cpu/mtrr/main.c > +++ b/xen/arch/x86/cpu/mtrr/main.c > @@ -340,7 +340,7 @@ int mtrr_add_page(unsigned long base, un > return -EINVAL; > } > > - if (base & size_or_mask || size & size_or_mask) { > + if ((base | (base + size - 1)) >> (paddr_bits - PAGE_SHIFT)) { > printk(KERN_WARNING "mtrr: base or size exceeds the MTRR width\n"); > return -EINVAL; > } > > >