From: David Hildenbrand Date: Thu, 5 Aug 2021 09:23:50 +0000 (+0200) Subject: softmmu/physmem: fix wrong assertion in qemu_ram_alloc_internal() X-Git-Tag: qemu-xen-4.16.0-rc4~4 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=1c4c68593610e81fc3ba8d3919ec3fc9f26e063d;p=qemu-xen.git softmmu/physmem: fix wrong assertion in qemu_ram_alloc_internal() When adding RAM_NORESERVE, we forgot to remove the old assertion when adding the updated one, most probably when reworking the patches or rebasing. We can easily crash QEMU by adding -object memory-backend-ram,id=mem0,size=500G,reserve=off to the QEMU cmdline: qemu-system-x86_64: ../softmmu/physmem.c:2146: qemu_ram_alloc_internal: Assertion `(ram_flags & ~(RAM_SHARED | RAM_RESIZEABLE | RAM_PREALLOC)) == 0' failed. Fix it by removing the old assertion. Fixes: 8dbe22c6868b ("memory: Introduce RAM_NORESERVE and wire it up in qemu_ram_mmap()") Reviewed-by: Peter Xu Reviewed-by: Philippe Mathieu-Daudé Tested-by: Philippe Mathieu-Daudé Reviewed-by: Pankaj Gupta Signed-off-by: David Hildenbrand Message-id: 20210805092350.31195-1-david@redhat.com Cc: Paolo Bonzini Cc: Peter Xu Cc: Philippe Mathieu-Daudé Signed-off-by: David Hildenbrand Signed-off-by: Peter Maydell --- diff --git a/softmmu/physmem.c b/softmmu/physmem.c index 3c1912a1a0..2e18947598 100644 --- a/softmmu/physmem.c +++ b/softmmu/physmem.c @@ -2143,7 +2143,6 @@ RAMBlock *qemu_ram_alloc_internal(ram_addr_t size, ram_addr_t max_size, RAMBlock *new_block; Error *local_err = NULL; - assert((ram_flags & ~(RAM_SHARED | RAM_RESIZEABLE | RAM_PREALLOC)) == 0); assert((ram_flags & ~(RAM_SHARED | RAM_RESIZEABLE | RAM_PREALLOC | RAM_NORESERVE)) == 0); assert(!host ^ (ram_flags & RAM_PREALLOC));