qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Igor Mammedov <imammedo@redhat.com>
To: Hu Tao <hutao@cn.fujitsu.com>
Cc: Yasunori Goto <y-goto@jp.fujitsu.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	qemu-devel@nongnu.org, Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v2 3/4] memory-backend-file: improve error handling
Date: Tue, 17 Jun 2014 12:03:13 +0200	[thread overview]
Message-ID: <20140617120313.09e90c6f@nial.usersys.redhat.com> (raw)
In-Reply-To: <d4becbb753847190c1e515c68d737eb887d3322a.1402912665.git.hutao@cn.fujitsu.com>

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?

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

  reply	other threads:[~2014-06-17 10:03 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 [this message]
2014-06-17 10:09     ` Hu Tao
2014-06-17 10:56       ` Michael S. Tsirkin
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=20140617120313.09e90c6f@nial.usersys.redhat.com \
    --to=imammedo@redhat.com \
    --cc=hutao@cn.fujitsu.com \
    --cc=mst@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).