]> rtime.felk.cvut.cz Git - lisovros/qemu_apohw.git/commitdiff
numa: handle mmaped memory allocation failure correctly
authorIgor Mammedov <imammedo@redhat.com>
Tue, 17 Jun 2014 10:17:05 +0000 (12:17 +0200)
committerMichael S. Tsirkin <mst@redhat.com>
Thu, 19 Jun 2014 15:44:22 +0000 (18:44 +0300)
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 <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
numa.c

diff --git a/numa.c b/numa.c
index eef071778551443a1bb88cb5f346a855481db0bd..e471afe04acb25f4073569a55ce76b9e24592aa5 100644 (file)
--- 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);