From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53870) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WwqSJ-0005qT-Ul for qemu-devel@nongnu.org; Tue, 17 Jun 2014 06:17:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WwqS9-0000ew-AQ for qemu-devel@nongnu.org; Tue, 17 Jun 2014 06:17:31 -0400 Received: from mx1.redhat.com ([209.132.183.28]:11359) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WwqS9-0000en-2V for qemu-devel@nongnu.org; Tue, 17 Jun 2014 06:17:21 -0400 From: Igor Mammedov Date: Tue, 17 Jun 2014 12:17:05 +0200 Message-Id: <1403000225-19812-1-git-send-email-imammedo@redhat.com> Subject: [Qemu-devel] [PATCH for 2.1] numa: handle mmaped memory allocation failure correctly List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: hutao@cn.fujitsu.com, pbonzini@redhat.com, gaowanlong@cn.fujitsu.com, mst@redhat.com 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 --- patch depends on current PCI tree that stages last NUMA series numa.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/numa.c b/numa.c index eef0717..e471afe 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); -- 1.7.1