qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Igor Mammedov <imammedo@redhat.com>
To: qemu-devel@nongnu.org
Cc: hutao@cn.fujitsu.com, pbonzini@redhat.com,
	gaowanlong@cn.fujitsu.com, mst@redhat.com
Subject: [Qemu-devel] [PATCH for 2.1] numa: handle mmaped memory allocation failure correctly
Date: Tue, 17 Jun 2014 12:17:05 +0200	[thread overview]
Message-ID: <1403000225-19812-1-git-send-email-imammedo@redhat.com> (raw)

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>
---
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

             reply	other threads:[~2014-06-17 10:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-17 10:17 Igor Mammedov [this message]
2014-06-17 11:22 ` [Qemu-devel] [PATCH for 2.1] numa: handle mmaped memory allocation failure correctly Michael S. Tsirkin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1403000225-19812-1-git-send-email-imammedo@redhat.com \
    --to=imammedo@redhat.com \
    --cc=gaowanlong@cn.fujitsu.com \
    --cc=hutao@cn.fujitsu.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).