From: Heiko Carstens Date: Mon, 5 Nov 2007 10:10:11 +0000 (+0100) Subject: [S390] Fix memory detection. X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=0b8da654b6c13b40b0e0efd916ee57ed13f9fa1f;p=linux-beck.git [S390] Fix memory detection. Yet another patch in the countless series of memory detection fixes: if the last area of the reported storage size is a hole the detection loop will loop forever. Just break chunk detection loop if its end is going to be larger than reported storage size. Signed-off-by: Heiko Carstens Signed-off-by: Martin Schwidefsky --- diff --git a/arch/s390/kernel/early.c b/arch/s390/kernel/early.c index e6289ee74ecd..8bf4ae1150be 100644 --- a/arch/s390/kernel/early.c +++ b/arch/s390/kernel/early.c @@ -200,11 +200,13 @@ static noinline __init void find_memory_chunks(unsigned long memsize) cc = __tprot(addr); while (cc == old_cc) { addr += CHUNK_INCR; - cc = __tprot(addr); + if (addr >= memsize) + break; #ifndef CONFIG_64BIT if (addr == ADDR2G) break; #endif + cc = __tprot(addr); } if (old_addr != addr &&