qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH RFC 4/4] memory-backend-file: error out if faile


From: Hu Tao
Subject: Re: [Qemu-devel] [PATCH RFC 4/4] memory-backend-file: error out if failed to allocate memory
Date: Mon, 16 Jun 2014 14:30:15 +0800
User-agent: Mutt/1.5.21 (2010-09-15)

On Sat, Jun 14, 2014 at 07:09:37PM +0200, Paolo Bonzini wrote:
> Il 14/06/2014 06:48, Hu Tao ha scritto:
> >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)
> >
> >This patch fixes this problem.
> >
> >Signed-off-by: Hu Tao <address@hidden>
> >---
> > backends/hostmem-file.c | 3 +++
> > 1 file changed, 3 insertions(+)
> >
> >diff --git a/backends/hostmem-file.c b/backends/hostmem-file.c
> >index 5179994..70172d1 100644
> >--- a/backends/hostmem-file.c
> >+++ b/backends/hostmem-file.c
> >@@ -55,6 +55,9 @@ file_backend_memory_alloc(HostMemoryBackend *backend, 
> >Error **errp)
> >                                  object_get_canonical_path(OBJECT(backend)),
> >                                  backend->size, fb->share,
> >                                  fb->mem_path, errp);
> >+        if (backend->mr.ram_addr == -1) {
> >+            error_setg(errp, "failed to allocate memory");
> >+        }
> 
> qemu_ram_alloc_from_file is where this error_setg should be added instead.

Thanks, patch updated.

> 
> Paolo
> 
> >     }
> > #endif
> > }
> >



reply via email to

[Prev in Thread] Current Thread [Next in Thread]