summaryrefslogtreecommitdiffstats
path: root/arch/arm/lib/bootm.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2016-10-18 09:42:50 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2016-10-18 09:42:52 +0200
commit834f6bf5e5f1169065376ad1aeb6a6266e66ce5c (patch)
tree1b98924d467ea04b2417898a70cc725f0f2f6efd /arch/arm/lib/bootm.c
parent3c4cb21e75069370d915c3790683a252d9b213fd (diff)
downloadbarebox-834f6bf5e5f1169065376ad1aeb6a6266e66ce5c.tar.gz
barebox-834f6bf5e5f1169065376ad1aeb6a6266e66ce5c.tar.xz
ARM: bootm: Fix free_mem calculation when initrd is given
When a initrd is given we calculate the next free memory position as: free_mem = PAGE_ALIGN(initrd_end); This is wrong when initrd_end exactly falls on a page boundary. In this case PAGE_ALIGN() does nothing and free_mem becomes initrd_end and the following bootm_load_devicetree() and thus booting fails with -ENOMEM. Fix this by correctly advancing to the next free memory position. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/lib/bootm.c')
-rw-r--r--arch/arm/lib/bootm.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c
index 56663feb89..9f3d950de6 100644
--- a/arch/arm/lib/bootm.c
+++ b/arch/arm/lib/bootm.c
@@ -158,7 +158,7 @@ static int __do_bootm_linux(struct image_data *data, unsigned long free_mem, int
initrd_start = data->initrd_res->start;
initrd_end = data->initrd_res->end;
initrd_size = resource_size(data->initrd_res);
- free_mem = PAGE_ALIGN(initrd_end);
+ free_mem = PAGE_ALIGN(initrd_end + 1);
}
ret = bootm_load_devicetree(data, free_mem);