summaryrefslogtreecommitdiffstats
path: root/mm/memblock.c
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2010-07-28 15:25:10 +1000
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2010-08-05 12:56:30 +1000
commit25818f0f288cd5333ba5a90ad6dde3def4c4ff58 (patch)
tree993384eff73bac874201d342c43a8e596dd1f485 /mm/memblock.c
parent37d8d4bf489e39eedc9537f8616fe87879b13cb0 (diff)
downloadlinux-25818f0f288cd5333ba5a90ad6dde3def4c4ff58.tar.gz
linux-25818f0f288cd5333ba5a90ad6dde3def4c4ff58.tar.bz2
linux-25818f0f288cd5333ba5a90ad6dde3def4c4ff58.zip
memblock: Make MEMBLOCK_ERROR be 0
And ensure we don't hand out 0 as a valid allocation. We put the low limit at PAGE_SIZE arbitrarily. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'mm/memblock.c')
-rw-r--r--mm/memblock.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/mm/memblock.c b/mm/memblock.c
index 85cfa1d3ab28..cb520df2a414 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -105,6 +105,12 @@ static phys_addr_t __init memblock_find_region(phys_addr_t start, phys_addr_t en
phys_addr_t base, res_base;
long j;
+ /* Prevent allocations returning 0 as it's also used to
+ * indicate an allocation failure
+ */
+ if (start == 0)
+ start = PAGE_SIZE;
+
base = memblock_align_down((end - size), align);
while (start <= base) {
j = memblock_overlaps_region(&memblock.reserved, base, size);