[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH] hw/core: fix segmentation fault
From: |
Suramya Shah |
Subject: |
[Qemu-devel] [PATCH] hw/core: fix segmentation fault |
Date: |
Sat, 8 Apr 2017 20:35:24 +0530 |
Reproducer:
$i386-softmmu/qemu-system-i386 -S -machine isapc,accel=tcg -device amd-iommu
Segmentation fault (core dumped)
Partial bt:
#0 bus_add_child (child=0x555556d4e520, bus=0x0) at hw/core/qdev.c:88
#1 qdev_set_parent_bus (dev=0x555556d4e520, address@hidden)
at hw/core/qdev.c:119
Signed-off-by: Suramya Shah <address@hidden>
---
hw/core/qdev.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/hw/core/qdev.c b/hw/core/qdev.c
index 1e7fb33..07a211b 100644
--- a/hw/core/qdev.c
+++ b/hw/core/qdev.c
@@ -84,7 +84,11 @@ static void bus_add_child(BusState *bus, DeviceState *child)
{
char name[32];
BusChild *kid = g_malloc0(sizeof(*kid));
-
+
+ if (!bus) {
+ error_report("bus not found ");
+ exit(0);
+ }
kid->index = bus->max_index++;
kid->child = child;
object_ref(OBJECT(kid->child));
--
2.9.3
- [Qemu-devel] [PATCH] hw/core: fix segmentation fault,
Suramya Shah <=