From: Peng Fan Date: Mon, 18 Oct 2021 22:15:45 +0000 (-0700) Subject: memblock: check memory total_size X-Git-Tag: v5.15-rc7~31^2~11 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5173ed72bcfcddda21ff274ee31c6472fa150f29;p=thirdparty%2Fkernel%2Flinux.git memblock: check memory total_size mem=[X][G|M] is broken on ARM64 platform, there are cases that even type.cnt is 1, but total_size is not 0 because regions are merged into 1. So only check 'cnt' is not enough, total_size should be used, othersize bootargs 'mem=[X][G|B]' not work anymore. Link: https://lkml.kernel.org/r/20210930024437.32598-1-peng.fan@oss.nxp.com Fixes: e888fa7bb882 ("memblock: Check memory add/cap ordering") Signed-off-by: Peng Fan Reviewed-by: Mike Rapoport Cc: Geert Uytterhoeven Cc: David Hildenbrand Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/mm/memblock.c b/mm/memblock.c index 5c3503c98b2f1..b91df5cf54d34 100644 --- a/mm/memblock.c +++ b/mm/memblock.c @@ -1692,7 +1692,7 @@ void __init memblock_cap_memory_range(phys_addr_t base, phys_addr_t size) if (!size) return; - if (memblock.memory.cnt <= 1) { + if (!memblock_memory->total_size) { pr_warn("%s: No memory registered yet\n", __func__); return; }