[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 16/40] ivshmem: Fix harmless misuse of Error
From: |
Markus Armbruster |
Subject: |
[Qemu-devel] [PULL 16/40] ivshmem: Fix harmless misuse of Error |
Date: |
Fri, 18 Mar 2016 18:01:03 +0100 |
We reuse errp after passing it host_memory_backend_get_memory(). If
both host_memory_backend_get_memory() and the reuse set an error, the
reuse will fail the assertion in error_setv(). Fortunately,
host_memory_backend_get_memory() can't fail.
Pass it &error_abort to make our assumption explicit, and to get the
assertion failure in the right place should it become invalid.
Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Marc-André Lureau <address@hidden>
Message-Id: <address@hidden>
---
hw/misc/ivshmem.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c
index 0ac0238..299cf5b 100644
--- a/hw/misc/ivshmem.c
+++ b/hw/misc/ivshmem.c
@@ -842,7 +842,7 @@ static void pci_ivshmem_realize(PCIDevice *dev, Error
**errp)
g_warning("size argument ignored with hostmem");
}
- mr = host_memory_backend_get_memory(s->hostmem, errp);
+ mr = host_memory_backend_get_memory(s->hostmem, &error_abort);
s->ivshmem_size = memory_region_size(mr);
} else if (s->sizearg == NULL) {
s->ivshmem_size = 4 << 20; /* 4 MB default */
@@ -907,7 +907,8 @@ static void pci_ivshmem_realize(PCIDevice *dev, Error
**errp)
IVSHMEM_DPRINTF("using hostmem\n");
- mr = host_memory_backend_get_memory(MEMORY_BACKEND(s->hostmem), errp);
+ mr = host_memory_backend_get_memory(MEMORY_BACKEND(s->hostmem),
+ &error_abort);
vmstate_register_ram(mr, DEVICE(s));
memory_region_add_subregion(&s->bar, 0, mr);
pci_register_bar(PCI_DEVICE(s), 2, attr, &s->bar);
@@ -1134,7 +1135,7 @@ static void ivshmem_check_memdev_is_busy(Object *obj,
const char *name,
{
MemoryRegion *mr;
- mr = host_memory_backend_get_memory(MEMORY_BACKEND(val), errp);
+ mr = host_memory_backend_get_memory(MEMORY_BACKEND(val), &error_abort);
if (memory_region_is_mapped(mr)) {
char *path = object_get_canonical_path_component(val);
error_setg(errp, "can't use already busy memdev: %s", path);
--
2.4.3
- [Qemu-devel] [PULL 26/40] ivshmem: Propagate errors through ivshmem_recv_setup(), (continued)
- [Qemu-devel] [PULL 26/40] ivshmem: Propagate errors through ivshmem_recv_setup(), Markus Armbruster, 2016/03/18
- [Qemu-devel] [PULL 10/40] ivshmem: Rewrite specification document, Markus Armbruster, 2016/03/18
- [Qemu-devel] [PULL 32/40] ivshmem: Simplify memory regions for BAR 2 (shared memory), Markus Armbruster, 2016/03/18
- [Qemu-devel] [PULL 04/40] qemu-doc: Fix ivshmem huge page example, Markus Armbruster, 2016/03/18
- [Qemu-devel] [PULL 29/40] ivshmem: Simplify how we cope with short reads from server, Markus Armbruster, 2016/03/18
- [Qemu-devel] [PULL 19/40] ivshmem: Clean up MSI-X conditions, Markus Armbruster, 2016/03/18
- [Qemu-devel] [PULL 35/40] ivshmem: Replace int role_val by OnOffAuto master, Markus Armbruster, 2016/03/18
- [Qemu-devel] [PULL 13/40] ivshmem: Clean up after commit 9940c32, Markus Armbruster, 2016/03/18
- [Qemu-devel] [PULL 02/40] ivshmem-server: Fix and clean up command line help, Markus Armbruster, 2016/03/18
- [Qemu-devel] [PULL 23/40] ivshmem: Disentangle ivshmem_read(), Markus Armbruster, 2016/03/18
- [Qemu-devel] [PULL 16/40] ivshmem: Fix harmless misuse of Error,
Markus Armbruster <=
- [Qemu-devel] [PULL 17/40] ivshmem: Failed realize() can leave migration blocker behind, Markus Armbruster, 2016/03/18
- [Qemu-devel] [PULL 25/40] ivshmem: Receive shared memory synchronously in realize(), Markus Armbruster, 2016/03/18
- [Qemu-devel] [PULL 30/40] ivshmem: Tighten check of property "size", Markus Armbruster, 2016/03/18
- [Qemu-devel] [PULL 27/40] ivshmem: Rely on server sending the ID right after the version, Markus Armbruster, 2016/03/18
- [Qemu-devel] [PULL 37/40] ivshmem: Clean up after the previous commit, Markus Armbruster, 2016/03/18
- [Qemu-devel] [PULL 28/40] ivshmem: Drop the hackish test for UNIX domain chardev, Markus Armbruster, 2016/03/18
- [Qemu-devel] [PULL 31/40] ivshmem: Implement shm=... with a memory backend, Markus Armbruster, 2016/03/18
- [Qemu-devel] [PULL 21/40] ivshmem: Assert interrupts are set up once, Markus Armbruster, 2016/03/18
- [Qemu-devel] [PULL 40/40] contrib/ivshmem-server: Print "not for production" warning, Markus Armbruster, 2016/03/18
- [Qemu-devel] [PULL 34/40] qdev: New DEFINE_PROP_ON_OFF_AUTO, Markus Armbruster, 2016/03/18