From e40d712309314322a5ff6779d941e3fa525411b2 Mon Sep 17 00:00:00 2001 From: Jiacheng Zheng Date: Thu, 14 May 2020 15:40:45 +0800 Subject: [PATCH] mm/memblock.c: fix bug in early_dyn_memhotplug idx should be added after it is used, now it's added before it is used. This is a bug, so fix it. Change-Id: Ia875350b5cd30f9a8c1b57edac61163ef4e11cb1 Signed-off-by: Jiacheng Zheng --- mm/memblock.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/memblock.c b/mm/memblock.c index 5d311590ae53..deaf4c018e1e 100644 --- a/mm/memblock.c +++ b/mm/memblock.c @@ -1838,8 +1838,8 @@ static int __init early_dyn_memhotplug(char *p) struct memblock_region *rgn; int blk = 0; - while ((idx++) < memblock.memory.cnt) { - rgn = &memblock.memory.regions[idx]; + while (idx < memblock.memory.cnt) { + rgn = &memblock.memory.regions[idx++]; addr = ALIGN(rgn->base, MIN_MEMORY_BLOCK_SIZE); rgn_end = rgn->base + rgn->size; while (addr + MIN_MEMORY_BLOCK_SIZE <= rgn_end) {