From: Igor Mammedov Date: Tue, 17 Jun 2014 10:17:05 +0000 (+0200) Subject: numa: handle mmaped memory allocation failure correctly X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=c3ba3095070728f9c247f9e89652b9ea3f94319f;p=qemu.git numa: handle mmaped memory allocation failure correctly when memory_region_init_ram_from_file() fails memory_region_size() will still return size that was provided at region init time. Instead use errp to properly detect error condition. Signed-off-by: Igor Mammedov Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- diff --git a/numa.c b/numa.c index eef0717785..e471afe04a 100644 --- a/numa.c +++ b/numa.c @@ -238,7 +238,7 @@ static void allocate_system_memory_nonnuma(MemoryRegion *mr, Object *owner, /* Legacy behavior: if allocation failed, fall back to * regular RAM allocation. */ - if (!memory_region_size(mr)) { + if (err) { qerror_report_err(err); error_free(err); memory_region_init_ram(mr, owner, name, ram_size);