Memory regions / qemu ramblocks always have to have a size > 0. Especially, otherwise, ramblock_ptr() will bail out with an assert. Enforce this.
Signed-off-by: David Hildenbrand <da...@redhat.com> --- exec.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/exec.c b/exec.c index 5bc9b231c4..161e40e16e 100644 --- a/exec.c +++ b/exec.c @@ -2160,6 +2160,11 @@ int qemu_ram_resize(RAMBlock *block, ram_addr_t newsize, Error **errp) return 0; } + if (!newsize) { + error_setg_errno(errp, EINVAL, "Length cannot be 0: %s", block->idstr); + return -EINVAL; + } + if (!qemu_ram_is_resizable(block)) { error_setg_errno(errp, EINVAL, "Length mismatch: %s: 0x" RAM_ADDR_FMT -- 2.24.1