fix error handling of mmap() calls (#1283)

This commit is contained in:
Dominik Maier 2020-06-05 04:30:23 +02:00 committed by GitHub
parent ad80f042c4
commit a4784cc96c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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);