From a4784cc96c71e51235044d42c860a840083ad1c8 Mon Sep 17 00:00:00 2001 From: Dominik Maier Date: Fri, 5 Jun 2020 04:30:23 +0200 Subject: [PATCH] fix error handling of mmap() calls (#1283) --- qemu/exec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qemu/exec.c b/qemu/exec.c index e6923862..9e4fa5d1 100644 --- a/qemu/exec.c +++ b/qemu/exec.c @@ -1154,7 +1154,7 @@ void qemu_ram_remap(struct uc_struct *uc, ram_addr_t addr, ram_addr_t length) area = mmap(vaddr, length, PROT_READ | PROT_WRITE, flags, -1, 0); } - if (area != vaddr) { + if (area == MAP_FAILED || area != vaddr) { fprintf(stderr, "Could not remap addr: " RAM_ADDR_FMT "@" RAM_ADDR_FMT "\n", length, addr);