From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58203) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WwxOY-0000Wg-MQ for qemu-devel@nongnu.org; Tue, 17 Jun 2014 13:42:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WwxOS-0005Iw-6K for qemu-devel@nongnu.org; Tue, 17 Jun 2014 13:42:06 -0400 Received: from mx1.redhat.com ([209.132.183.28]:17356) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WwxOR-0005Ip-Uz for qemu-devel@nongnu.org; Tue, 17 Jun 2014 13:42:00 -0400 Date: Tue, 17 Jun 2014 20:42:20 +0300 From: "Michael S. Tsirkin" Message-ID: <1403021756-15960-99-git-send-email-mst@redhat.com> References: <1403021756-15960-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1403021756-15960-1-git-send-email-mst@redhat.com> Subject: [Qemu-devel] [PULL 098/103] 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: Peter Maydell , Eduardo Habkost , Hu Tao , Anthony Liguori , Igor Mammedov , Paolo Bonzini , Wanlong Gao From: Igor Mammedov 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 --- numa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); -- MST