From: Paul Burton Date: Mon, 26 Sep 2016 18:28:56 +0000 (+0100) Subject: MIPS: Use ram_top, not bi_memsize, in arch_lmb_reserve X-Git-Tag: v2017.01-rc1~154^2~1 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=7a3e0f74a7c3ff83ba0607ebf8a14310ff08db60;p=u-boot MIPS: Use ram_top, not bi_memsize, in arch_lmb_reserve When calculating the region to reserve for the stack in arch_lmb_reserve, make use of ram_top instead of adding bi_memsize to CONFIG_SYS_SDRAM_BASE. This avoids overflow if the system has enough memory to reach the end of the address space. Signed-off-by: Paul Burton --- diff --git a/arch/mips/lib/bootm.c b/arch/mips/lib/bootm.c index 0c6a4ab3b3..9fec4ad438 100644 --- a/arch/mips/lib/bootm.c +++ b/arch/mips/lib/bootm.c @@ -42,7 +42,7 @@ void arch_lmb_reserve(struct lmb *lmb) /* adjust sp by 4K to be safe */ sp -= 4096; - lmb_reserve(lmb, sp, CONFIG_SYS_SDRAM_BASE + gd->ram_size - sp); + lmb_reserve(lmb, sp, gd->ram_top - sp); } static void linux_cmdline_init(void)