[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-stable] [PATCH 04/26] qom/object: Don't poll cast cache for NULL o
From: |
Michael Roth |
Subject: |
[Qemu-stable] [PATCH 04/26] qom/object: Don't poll cast cache for NULL objects |
Date: |
Wed, 12 Jun 2013 16:41:16 -0500 |
From: Peter Crosthwaite <address@hidden>
object_dynamic_cast_assert used to be tolerant of NULL objects and not
assert. It's clear from the implementation that this is the expected
behavior.
The preceding check of the cast cache dereferences obj however causing
a segfault. Fix by conditionalizing the cast cache logic on obj being
non-null.
Signed-off-by: Peter Crosthwaite <address@hidden>
Reviewed-by: Andreas Färber <address@hidden>
Reviewed-by: Anthony Liguori <address@hidden>
Reviewed-by: Paolo Bonzini <address@hidden>
Reviewed-by: Edgar E. Iglesias <address@hidden>
Message-id: address@hidden
Signed-off-by: Anthony Liguori <address@hidden>
(cherry picked from commit 95916abcf428fb03644468c7fbce64356c6483c0)
Signed-off-by: Michael Roth <address@hidden>
---
qom/object.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/qom/object.c b/qom/object.c
index ec88231..803b94b 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -442,7 +442,7 @@ Object *object_dynamic_cast_assert(Object *obj, const char
*typename,
int i;
Object *inst;
- for (i = 0; i < OBJECT_CLASS_CAST_CACHE; i++) {
+ for (i = 0; obj && i < OBJECT_CLASS_CAST_CACHE; i++) {
if (obj->class->cast_cache[i] == typename) {
goto out;
}
@@ -458,7 +458,7 @@ Object *object_dynamic_cast_assert(Object *obj, const char
*typename,
assert(obj == inst);
- if (obj == inst) {
+ if (obj && obj == inst) {
for (i = 1; i < OBJECT_CLASS_CAST_CACHE; i++) {
obj->class->cast_cache[i - 1] = obj->class->cast_cache[i];
}
--
1.7.9.5
- [Qemu-stable] Patch Round-up for stable 1.5.1, freeze on 2013-06-19, Michael Roth, 2013/06/12
- [Qemu-stable] [PATCH 01/26] hw/9pfs: Fix segfault with 9p2000.u, Michael Roth, 2013/06/12
- [Qemu-stable] [PATCH 03/26] rtl8139: flush queued packets when RxBufPtr is written, Michael Roth, 2013/06/12
- [Qemu-stable] [PATCH 02/26] hw/9pfs: use O_NOFOLLOW for mapped readlink operation, Michael Roth, 2013/06/12
- [Qemu-stable] [PATCH 04/26] qom/object: Don't poll cast cache for NULL objects,
Michael Roth <=
- [Qemu-stable] [PATCH 05/26] xen: simplify xen_enabled, Michael Roth, 2013/06/12
- [Qemu-stable] [PATCH 06/26] main_loop: do not set nonblocking if xen_enabled(), Michael Roth, 2013/06/12
- [Qemu-stable] [PATCH 07/26] xen_machine_pv: do not create a dummy CPU in machine->init, Michael Roth, 2013/06/12
- [Qemu-stable] [PATCH 08/26] chardev: fix "info chardev" output, Michael Roth, 2013/06/12
- [Qemu-stable] [PATCH 09/26] ide: Set BSY bit during FLUSH, Michael Roth, 2013/06/12
- [Qemu-stable] [PATCH 10/26] Revert "roms: switch oldnoconfig to olddefconfig", Michael Roth, 2013/06/12
- [Qemu-stable] [PATCH 12/26] target-i386: fix abort on bad PML4E/PDPTE/PDE/PTE addresses, Michael Roth, 2013/06/12
- [Qemu-stable] [PATCH 13/26] Remove OSS support for OpenBSD, Michael Roth, 2013/06/12
- [Qemu-stable] [PATCH 14/26] xen: start PCI hole at 0xe0000000 (same as pc_init1 and qemu-xen-traditional), Michael Roth, 2013/06/12
- [Qemu-stable] [PATCH 15/26] do not check pointers after dereferencing them, Michael Roth, 2013/06/12