Reorder the code so the assertion of block occurs before it is used in the subsequent lines.
Signed-off-by: Sergei Heifetz <[email protected]> --- system/physmem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/system/physmem.c b/system/physmem.c index b0311f4531..4308e02940 100644 --- a/system/physmem.c +++ b/system/physmem.c @@ -2054,11 +2054,11 @@ static int memory_try_enable_merging(void *addr, size_t len) */ int qemu_ram_resize(RAMBlock *block, ram_addr_t newsize, Error **errp) { + assert(block); + const ram_addr_t oldsize = block->used_length; const ram_addr_t unaligned_size = newsize; - assert(block); - newsize = TARGET_PAGE_ALIGN(newsize); newsize = REAL_HOST_PAGE_ALIGN(newsize); -- 2.34.1
