[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH RFC 4/4] memory-backend-file: error out if failed to
From: |
Hu Tao |
Subject: |
[Qemu-devel] [PATCH RFC 4/4] memory-backend-file: error out if failed to allocate memory |
Date: |
Sat, 14 Jun 2014 12:48:59 +0800 |
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");
+ }
}
#endif
}
--
1.9.3
- [Qemu-devel] [PATCH RFC 1/4] get rid of signed range, (continued)
- [Qemu-devel] [PATCH RFC 3/4] exec: don't exit unconditionally if failed to allocate memory, Hu Tao, 2014/06/14
- Re: [Qemu-devel] [PATCH RFC 3/4] exec: don't exit unconditionally if failed to allocate memory, Paolo Bonzini, 2014/06/14
- Re: [Qemu-devel] [PATCH RFC 3/4] exec: don't exit unconditionally if failed to allocate memory, Michael S. Tsirkin, 2014/06/15
- Re: [Qemu-devel] [PATCH RFC 3/4] exec: don't exit unconditionally if failed to allocate memory, Hu Tao, 2014/06/16
- [Qemu-devel] [PATCH RFC 2/4] check if we have space left for hotplugged memory, Hu Tao, 2014/06/14
- Re: [Qemu-devel] [PATCH RFC 2/4] check if we have space left for hotplugged memory, Michael S. Tsirkin, 2014/06/15
- Re: [Qemu-devel] [PATCH RFC 2/4] check if we have space left for hotplugged memory, Hu Tao, 2014/06/16
- [Qemu-devel] [PATCH RFC 4/4] memory-backend-file: error out if failed to allocate memory,
Hu Tao <=
- Re: [Qemu-devel] [PATCH RFC 4/4] memory-backend-file: error out if failed to allocate memory, Paolo Bonzini, 2014/06/14
- Re: [Qemu-devel] [PATCH RFC 4/4] memory-backend-file: error out if failed to allocate memory, Hu Tao, 2014/06/16
- Re: [Qemu-devel] [PATCH RFC 0/4] fixes for pci tree, Michael S. Tsirkin, 2014/06/15
- Re: [Qemu-devel] [PATCH RFC 0/4] fixes for pci tree, Hu Tao, 2014/06/16
- Re: [Qemu-devel] [PATCH RFC 0/4] fixes for pci tree, Michael S. Tsirkin, 2014/06/16
- Re: [Qemu-devel] [PATCH RFC 0/4] fixes for pci tree, Hu Tao, 2014/06/16