diff options
authorRuss Anderson <>2012-05-10 13:01:46 -0700
committerLinus Torvalds <>2012-05-10 15:06:44 -0700
commit6bc2e853c6b46a6041980d58200ad9b0a73a60ff (patch)
parentb8cd742acfd78a4689148fb80cf74bc26e7f1f3c (diff)
mm: nobootmem: fix sign extend problem in __free_pages_memory()
Systems with 8 TBytes of memory or greater can hit a problem where only the the first 8 TB of memory shows up. This is due to "int i" being smaller than "unsigned long start_aligned", causing the high bits to be dropped. The fix is to change `i' to unsigned long to match start_aligned and end_aligned. Thanks to Jack Steiner for assistance tracking this down. Signed-off-by: Russ Anderson <> Cc: Jack Steiner <> Cc: Johannes Weiner <> Cc: Tejun Heo <> Cc: David S. Miller <> Cc: Yinghai Lu <> Cc: Gavin Shan <> Cc: <> Signed-off-by: Andrew Morton <> Signed-off-by: Linus Torvalds <>
1 files changed, 1 insertions, 2 deletions
diff --git a/mm/nobootmem.c b/mm/nobootmem.c
index e53bb8a256b1..1983fb1c7026 100644
--- a/mm/nobootmem.c
+++ b/mm/nobootmem.c
@@ -82,8 +82,7 @@ void __init free_bootmem_late(unsigned long addr, unsigned long size)
static void __init __free_pages_memory(unsigned long start, unsigned long end)
- int i;
- unsigned long start_aligned, end_aligned;
+ unsigned long i, start_aligned, end_aligned;
int order = ilog2(BITS_PER_LONG);
start_aligned = (start + (BITS_PER_LONG - 1)) & ~(BITS_PER_LONG - 1);