* [PATCH] Fix possible variable overflow in NUMA code
@ 2009-04-23 9:58 Yang, Xiaowei
0 siblings, 0 replies; only message in thread
From: Yang, Xiaowei @ 2009-04-23 9:58 UTC (permalink / raw)
To: xen-devel@lists.xensource.com
On PAE system, when "<<" operation is used on type "long" to get a 64-bit value, the
result could be overflowed.
Signed-off-by: Yang Xiaowei <xiaowei.yang@intel.com>
Thanks,
xiaowei
diff -r dd91d71d4eca xen/arch/x86/numa.c
--- a/xen/arch/x86/numa.c Tue Apr 21 17:03:23 2009 +0800
+++ b/xen/arch/x86/numa.c Thu Apr 23 13:57:17 2009 +0800
@@ -74,7 +74,7 @@ populate_memnodemap(const struct node *n
if (memnodemap[addr >> shift] != 0xff)
return -1;
memnodemap[addr >> shift] = i;
- addr += (1UL << shift);
+ addr += (1ULL << shift);
} while (addr < end);
res = 1;
}
@@ -290,7 +290,7 @@ static void dump_numa(unsigned char key)
(u32)(now>>32), (u32)now);
for_each_online_node(i) {
- paddr_t pa = (NODE_DATA(i)->node_start_pfn + 1)<< PAGE_SHIFT;
+ paddr_t pa = (paddr_t)(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,
@@ -314,7 +314,7 @@ static void dump_numa(unsigned char key)
page_list_for_each(page, &d->page_list)
{
- i = phys_to_nid(page_to_mfn(page) << PAGE_SHIFT);
+ i = phys_to_nid((paddr_t)page_to_mfn(page) << PAGE_SHIFT);
page_num_node[i]++;
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2009-04-23 9:58 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-23 9:58 [PATCH] Fix possible variable overflow in NUMA code Yang, Xiaowei
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.