When SDRAM reaches to the end of the address space the comparison membase + memsize evaluates to 0, so pc - membase < memsize can never be true. Fix this by substracting membase on both sides of the comparison. Signed-off-by: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx> --- arch/arm/cpu/uncompress.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/cpu/uncompress.c b/arch/arm/cpu/uncompress.c index 5bcce6b..b8e2e9f 100644 --- a/arch/arm/cpu/uncompress.c +++ b/arch/arm/cpu/uncompress.c @@ -60,7 +60,7 @@ void __noreturn barebox_multi_pbl_start(unsigned long membase, * to the current address. Otherwise it may be a readonly location. * Copy and relocate to the start of the memory in this case. */ - if (pc > membase && pc < membase + memsize) + if (pc > membase && pc - membase < memsize) relocate_to_current_adr(); else relocate_to_adr(membase); -- 2.7.0 _______________________________________________ barebox mailing list barebox@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/barebox