Skip to contentSkip to conversation

PFN_PHYS PAE overflow (fixes bug 242)

PATCH New Scott Parish 1 participant 1 message Oct 14, 2005

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PFN_PHYS PAE overflow (fixes bug 242)

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

Signature · 2 lines
Scott Parish
Signed-off-by: [email protected]
linux-2.6-xen-sparse/include/asm-xen/asm-i386/setup.h +1 -1
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
@@ -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

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel