ia64/xen-unstable
changeset 17218:f82baf1755ac
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@intel.com>
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@intel.com>
author | Keir Fraser <keir.fraser@citrix.com> |
---|---|
date | Mon Mar 17 11:18:06 2008 +0000 (2008-03-17) |
parents | 9f6117e9d7d9 |
children | 8325f200e194 |
files | xen/arch/x86/numa.c xen/include/asm-x86/numa.h |
line diff
1.1 --- a/xen/arch/x86/numa.c Mon Mar 17 11:16:08 2008 +0000 1.2 +++ b/xen/arch/x86/numa.c Mon Mar 17 11:18:06 2008 +0000 1.3 @@ -57,7 +57,7 @@ populate_memnodemap(const struct node *n 1.4 { 1.5 int i; 1.6 int res = -1; 1.7 - unsigned long addr, end; 1.8 + paddr_t addr, end; 1.9 1.10 if (shift >= 64) 1.11 return -1; 1.12 @@ -286,13 +286,13 @@ static void dump_numa(unsigned char key) 1.13 (u32)(now>>32), (u32)now); 1.14 1.15 for_each_online_node(i) { 1.16 - unsigned long pa = (NODE_DATA(i)->node_start_pfn + 1)<< PAGE_SHIFT; 1.17 + paddr_t pa = (NODE_DATA(i)->node_start_pfn + 1)<< PAGE_SHIFT; 1.18 printk("idx%d -> NODE%d start->%lu size->%lu\n", 1.19 i, NODE_DATA(i)->node_id, 1.20 NODE_DATA(i)->node_start_pfn, 1.21 NODE_DATA(i)->node_spanned_pages); 1.22 /* sanity check phys_to_nid() */ 1.23 - printk("phys_to_nid(%lx) -> %d should be %d\n", pa, phys_to_nid(pa), 1.24 + printk("phys_to_nid(%"PRIpaddr") -> %d should be %d\n", pa, phys_to_nid(pa), 1.25 NODE_DATA(i)->node_id); 1.26 } 1.27 for_each_online_cpu(i)
2.1 --- a/xen/include/asm-x86/numa.h Mon Mar 17 11:16:08 2008 +0000 2.2 +++ b/xen/include/asm-x86/numa.h Mon Mar 17 11:18:06 2008 +0000 2.3 @@ -52,7 +52,7 @@ struct node_data { 2.4 2.5 extern struct node_data node_data[]; 2.6 2.7 -static inline __attribute__((pure)) int phys_to_nid(unsigned long addr) 2.8 +static inline __attribute__((pure)) int phys_to_nid(paddr_t addr) 2.9 { 2.10 unsigned nid; 2.11 VIRTUAL_BUG_ON((addr >> memnode_shift) >= NODEMAPSIZE);