From: "Scott Parish" Subject: [patch] PFN_PHYS PAE overflow (fixes bug 242) Date: Fri, 14 Oct 2005 17:12:24 +0000 Message-ID: <20051014171223.GK3417@us.ibm.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="pQhZXvAqiZgbeUkD" Return-path: Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org --pQhZXvAqiZgbeUkD Content-Type: text/plain; charset=us-ascii Content-Disposition: inline machine_specific_memory_setup() makes the following call to setup e820: add_memory_region(0, PFN_PHYS(max_pfn), E820_RAM); Since max_pfn is (rightly) an unsigned long, we overflow for the current definition of PFN_PHYS. Attached is my preferred solution as it will hopefully avoid similar situations that may come up in the future. sRp -- Scott Parish Signed-off-by: srparish@us.ibm.com --pQhZXvAqiZgbeUkD Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="pfn_phys_overflow.diff" diff -rN -u -p old-xen-build2/linux-2.6-xen-sparse/include/asm-xen/asm-i386/setup.h new-xen-build2/linux-2.6-xen-sparse/include/asm-xen/asm-i386/setup.h --- old-xen-build2/linux-2.6-xen-sparse/include/asm-xen/asm-i386/setup.h 2005-10-04 19:08:26.000000000 +0000 +++ new-xen-build2/linux-2.6-xen-sparse/include/asm-xen/asm-i386/setup.h 2005-10-14 18:59:42.000000000 +0000 @@ -8,7 +8,7 @@ #define PFN_UP(x) (((x) + PAGE_SIZE-1) >> PAGE_SHIFT) #define PFN_DOWN(x) ((x) >> PAGE_SHIFT) -#define PFN_PHYS(x) ((x) << PAGE_SHIFT) +#define PFN_PHYS(x) ((unsigned long long)(x) << PAGE_SHIFT) /* * Reserved space for vmalloc and iomap - defined in asm/page.h --pQhZXvAqiZgbeUkD 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.xensource.com http://lists.xensource.com/xen-devel --pQhZXvAqiZgbeUkD--