mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 00:03:54 -06:00
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>
This commit is contained in:
parent
e1e84ba050
commit
39228250ce
4 changed files with 8 additions and 12 deletions
|
@ -112,9 +112,7 @@ void *qemu_anon_ram_alloc(size_t size)
|
|||
size_t offset = QEMU_ALIGN_UP((uintptr_t)ptr, align) - (uintptr_t)ptr;
|
||||
|
||||
if (ptr == MAP_FAILED) {
|
||||
fprintf(stderr, "Failed to allocate %zu B: %s\n",
|
||||
size, strerror(errno));
|
||||
abort();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ptr += offset;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue