Browse files

mm: nobootmem: fix sign extend problem in __free_pages_memory()

commit 6bc2e85 upstream.

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

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 <>
Signed-off-by: Andrew Morton <>
Signed-off-by: Linus Torvalds <>
Signed-off-by: Ben Hutchings <>
  • Loading branch information...
1 parent 97a2373 commit eceb33799bdb35305f9af781d07caa10d05958fe Russ Anderson committed with bwhacks May 10, 2012
Showing with 1 addition and 2 deletions.
  1. +1 −2 mm/nobootmem.c
@@ -83,8 +83,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);

0 comments on commit eceb337

Please sign in to comment.