s390/mem_detect: fix detect_memory() error handling
authorVasily Gorbik <gor@linux.ibm.com>
Fri, 27 Jan 2023 13:03:07 +0000 (14:03 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 10 Mar 2023 08:39:14 +0000 (09:39 +0100)
commit6ce9a22fc0213e7979119dbd8a2d8bf05fbf1bc8
tree0e96a63ad7b9229a5ff6048b4a1c59e75e2344ca
parent856fc2195494d1175ada0f1f46f92c5b28ce12eb
s390/mem_detect: fix detect_memory() error handling

[ Upstream commit 3400c35a4090704e6c465449616ab7e67a9209e7 ]

Currently if for some reason sclp_early_read_info() fails,
sclp_early_get_memsize() will not set max_physmem_end and it
will stay uninitialized. Any garbage value other than 0 will lead
to detect_memory() taking wrong path or returning a garbage value
as max_physmem_end. To avoid that simply initialize max_physmem_end.

Fixes: 73045a08cf55 ("s390: unify identity mapping limits handling")
Reported-by: Alexander Gordeev <agordeev@linux.ibm.com>
Reviewed-by: Alexander Gordeev <agordeev@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/s390/boot/mem_detect.c