[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-3.1-testing] x86 numa: Fix the overflow of physical addresses.
# HG changeset patch # User Keir Fraser <keir.fraser@xxxxxxxxxx> # Date 1206015449 0 # Node ID 366e946f2b9d266b0ca496880cf74432a326d175 # Parent 9443a268a96dfad69c624e2611c7e620b9cdc19d x86 numa: Fix the overflow of physical addresses. If memory address >4G, the address will overflow in some NUMA code if using unsigned long to statement a physical address in PAE arch. Replace "unsigned long" with paddr_t to avoid overflow. Signed-off-by: Duan Ronghui <ronghui.duan@xxxxxxxxx> xen-unstable changeset: 17201:f82baf1755ac6b4e1b77a35f160d26d30a094a1c xen-unstable date: Mon Mar 17 11:18:06 2008 +0000 --- xen/arch/x86/numa.c | 6 +++--- xen/include/asm-x86/numa.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff -r 9443a268a96d -r 366e946f2b9d xen/arch/x86/numa.c --- a/xen/arch/x86/numa.c Thu Mar 20 12:17:04 2008 +0000 +++ b/xen/arch/x86/numa.c Thu Mar 20 12:17:29 2008 +0000 @@ -57,7 +57,7 @@ populate_memnodemap(const struct node *n { int i; int res = -1; - unsigned long addr, end; + paddr_t addr, end; if (shift >= 64) return -1; @@ -286,13 +286,13 @@ static void dump_numa(unsigned char key) (u32)(now>>32), (u32)now); for_each_online_node(i) { - unsigned long pa = (NODE_DATA(i)->node_start_pfn + 1)<< PAGE_SHIFT; + paddr_t pa = (NODE_DATA(i)->node_start_pfn + 1)<< PAGE_SHIFT; printk("idx%d -> NODE%d start->%lu size->%lu\n", i, NODE_DATA(i)->node_id, NODE_DATA(i)->node_start_pfn, NODE_DATA(i)->node_spanned_pages); /* sanity check phys_to_nid() */ - printk("phys_to_nid(%lx) -> %d should be %d\n", pa, phys_to_nid(pa), + printk("phys_to_nid(%"PRIpaddr") -> %d should be %d\n", pa, phys_to_nid(pa), NODE_DATA(i)->node_id); } for_each_online_cpu(i) diff -r 9443a268a96d -r 366e946f2b9d xen/include/asm-x86/numa.h --- a/xen/include/asm-x86/numa.h Thu Mar 20 12:17:04 2008 +0000 +++ b/xen/include/asm-x86/numa.h Thu Mar 20 12:17:29 2008 +0000 @@ -52,7 +52,7 @@ struct node_data { extern struct node_data node_data[]; -static inline __attribute__((pure)) int phys_to_nid(unsigned long addr) +static inline __attribute__((pure)) int phys_to_nid(paddr_t addr) { unsigned nid; VIRTUAL_BUG_ON((addr >> memnode_shift) >= NODEMAPSIZE); _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |