From: "Jan Beulich" Subject: [PATCH] x86/MTRR: fix range check in mtrr_add_page() Date: Tue, 13 Aug 2013 16:45:01 +0100 Message-ID: <520A709D02000078000EB977@nat28.tlf.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__Part093A5C6D.0__=" Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1V9GmR-0005Yv-3Y for xen-devel@lists.xenproject.org; Tue, 13 Aug 2013 15:45:07 +0000 List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel Cc: Keir Fraser List-Id: xen-devel@lists.xenproject.org This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=__Part093A5C6D.0__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Extracted from Yinghai Lu's Linux commit d5c78673 ("x86: Fix /proc/mtrr with base/size more than 44bits"). Signed-off-by: Jan Beulich --- 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; } =20 - 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; } --=__Part093A5C6D.0__= Content-Type: text/plain; name="x86-MTRR-add-page-check.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="x86-MTRR-add-page-check.patch" x86/MTRR: fix range check in mtrr_add_page()=0A=0AExtracted from Yinghai = Lu's Linux commit d5c78673 ("x86: Fix /proc/mtrr=0Awith base/size more = than 44bits").=0A=0ASigned-off-by: Jan Beulich =0A=0A---= a/xen/arch/x86/cpu/mtrr/main.c=0A+++ b/xen/arch/x86/cpu/mtrr/main.c=0A@@ = -340,7 +340,7 @@ int mtrr_add_page(unsigned long base, un=0A = return -EINVAL;=0A }=0A =0A- if (base & size_or_mask || size & = size_or_mask) {=0A+ if ((base | (base + size - 1)) >> (paddr_bits - = PAGE_SHIFT)) {=0A printk(KERN_WARNING "mtrr: base or size = exceeds the MTRR width\n");=0A return -EINVAL;=0A }=0A --=__Part093A5C6D.0__= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel --=__Part093A5C6D.0__=--