From: "Yang, Xiaowei" <xiaowei.yang@intel.com>
To: "xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>
Subject: [PATCH] Fix possible variable overflow in NUMA code
Date: Thu, 23 Apr 2009 17:58:30 +0800 [thread overview]
Message-ID: <49F03BC6.7050901@intel.com> (raw)
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]++;
}
reply other threads:[~2009-04-23 9:58 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=49F03BC6.7050901@intel.com \
--to=xiaowei.yang@intel.com \
--cc=xen-devel@lists.xensource.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.