qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Hu Tao <hutao@cn.fujitsu.com>
Cc: Igor Mammedov <imammedo@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	qemu-devel@nongnu.org, Yasunori Goto <y-goto@jp.fujitsu.com>
Subject: Re: [Qemu-devel] [PATCH v2 3/4] memory-backend-file: improve error handling
Date: Tue, 17 Jun 2014 13:56:52 +0300	[thread overview]
Message-ID: <20140617105652.GC6991@redhat.com> (raw)
In-Reply-To: <20140617100908.GB10134@G08FNSTD100614.fnst.cn.fujitsu.com>

On Tue, Jun 17, 2014 at 06:09:08PM +0800, Hu Tao wrote:
> On Tue, Jun 17, 2014 at 12:03:13PM +0200, Igor Mammedov wrote:
> > On Mon, 16 Jun 2014 18:05:43 +0800
> > Hu Tao <hutao@cn.fujitsu.com> wrote:
> > 
> > > This patch fixes two problems of memory-backend-file:
> > > 
> > > 1. If user adds a memory-backend-file object using object_add command,
> > >    specifying a non-existing directory for property mem-path, qemu
> > >    will core dump with message:
> > > 
> > >      /nonexistingdir: No such file or directory
> > >      Bad ram offset fffffffffffff000
> > >      Aborted (core dumped)
> > > 
> > > 2. If user adds a memory-backend-file object using object_add command,
> > >    specifying a size that is less than huge page size, qemu
> > >    will core dump with message:
> > > 
> > >      Bad ram offset fffffffffffff000
> > >      Aborted (core dumped)
> > > 
> > > Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
> > > ---
> > >  exec.c | 26 ++++++++++++++++++--------
> > >  1 file changed, 18 insertions(+), 8 deletions(-)
> > > 
> > > diff --git a/exec.c b/exec.c
> > > index 8705cc5..a6afb4d 100644
> > > --- a/exec.c
> > > +++ b/exec.c
> > [...]
> > > @@ -1308,7 +1311,14 @@ ram_addr_t qemu_ram_alloc_from_file(ram_addr_t size, MemoryRegion *mr,
> > >          return -1;
> > >      }
> > >  
> > > -    return ram_block_add(new_block);
> > > +    addr = ram_block_add(new_block);
> > > +    if (addr == -1) {
> > how this hunk is relevant to commit message?
> > 
> > and more important in what case ram_block_add() returns -1?
> 
> See patch 03 int v1(titled [PATCH RFC 3/4] exec: don't exit unconditionally if failed to allocate memory)
> It is not included in this version but we'll fix it after the merge.

So maybe defer this hunk to after the merge too.

> > 
> > > +        g_free(new_block);
> > > +        error_setg(errp, "failed to allocate memory\n");
> > > +        return -1;
> > > +    }
> > > +
> > > +    return addr;
> > >  }
> > >  #endif
> > >  

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

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-16 10:05 [Qemu-devel] [PATCH v2 0/4] fixes for pci tree, v2 Hu Tao
2014-06-16 10:05 ` [Qemu-devel] [PATCH v2 1/4] qmp: add query-memdev Hu Tao
2014-06-16 17:38   ` Eric Blake
2014-06-16 10:05 ` [Qemu-devel] [PATCH v2 2/4] check if we have space left for hotplugged memory Hu Tao
2014-06-16 10:44   ` Igor Mammedov
2014-06-16 10:47   ` Igor Mammedov
2014-06-16 10:05 ` [Qemu-devel] [PATCH v2 3/4] memory-backend-file: improve error handling Hu Tao
2014-06-17 10:03   ` Igor Mammedov
2014-06-17 10:09     ` Hu Tao
2014-06-17 10:56       ` Michael S. Tsirkin [this message]
2014-06-16 10:05 ` [Qemu-devel] [PATCH v2 4/4] fixup! numa: add -numa node, memdev= option Hu Tao
2014-06-16 11:09 ` [Qemu-devel] [PATCH v2 0/4] fixes for pci tree, v2 Michael S. Tsirkin
2014-06-17  8:47   ` Hu Tao
2014-06-17 10:55     ` 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=20140617105652.GC6991@redhat.com \
    --to=mst@redhat.com \
    --cc=hutao@cn.fujitsu.com \
    --cc=imammedo@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=y-goto@jp.fujitsu.com \
    /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).