aboutsummaryrefslogtreecommitdiff
path: root/exec.c
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2013-07-31 15:11:11 +0200
committerAnthony Liguori <anthony@codemonkey.ws>2013-09-12 11:45:32 -0500
commit39228250ce6cf67eb1c3799791d271f53c5c6347 (patch)
treea9fb3a2fb09d86c1014c296593cd5d70ea4bf8b1 /exec.c
parente1e84ba050538bae24393e40b737078ecad99747 (diff)
exec: Don't abort when we can't allocate guest memory
We abort() on memory allocation failure. abort() is appropriate for programming errors. Maybe most memory allocation failures are programming errors, maybe not. But guest memory allocation failure isn't, and aborting when the user asks for more memory than we can provide is not nice. exit(1) instead, and do it in just one place, so the error message is consistent. Tested-by: Christian Borntraeger <borntraeger@de.ibm.com> Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Andreas Färber <afaerber@suse.de> Acked-by: Laszlo Ersek <lersek@redhat.com> Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Acked-by: Christian Borntraeger <borntraeger@de.ibm.com> Message-id: 1375276272-15988-8-git-send-email-armbru@redhat.com Signed-off-by: Anthony Liguori <anthony@codemonkey.ws>
Diffstat (limited to 'exec.c')
-rw-r--r--exec.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/exec.c b/exec.c
index 59debc9cd8..26469120d9 100644
--- a/exec.c
+++ b/exec.c
@@ -1150,6 +1150,11 @@ ram_addr_t qemu_ram_alloc_from_ptr(ram_addr_t size, void *host,
}
if (!new_block->host) {
new_block->host = phys_mem_alloc(size);
+ if (!new_block->host) {
+ fprintf(stderr, "Cannot set up guest memory '%s': %s\n",
+ new_block->mr->name, strerror(errno));
+ exit(1);
+ }
memory_try_enable_merging(new_block->host, size);
}
}