]> nv-tegra.nvidia Code Review - linux-2.6.git/commitdiff
mm: nobootmem: fix sign extend problem in __free_pages_memory()
authorRuss Anderson <rja@sgi.com>
Thu, 10 May 2012 20:01:46 +0000 (13:01 -0700)
committerVarun Wadekar <vwadekar@nvidia.com>
Fri, 18 May 2012 10:37:02 +0000 (16:07 +0530)
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 <rja@sgi.com>
Cc: Jack Steiner <steiner@sgi.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Tejun Heo <tj@kernel.org>
Cc: David S. Miller <davem@davemloft.net>
Cc: Yinghai Lu <yinghai@kernel.org>
Cc: Gavin Shan <shangw@linux.vnet.ibm.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/nobootmem.c

index e53bb8a256b196018c26899427897a0f471d8193..1983fb1c7026c0ef4c1e705298876d0ab2449c55 100644 (file)
@@ -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);