From nobody Sun Apr 28 20:57:26 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; dkim=fail spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1491664274238874.8577541257979; Sat, 8 Apr 2017 08:11:14 -0700 (PDT) Received: from localhost ([::1]:55510 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cws1A-00083E-Bh for importer@patchew.org; Sat, 08 Apr 2017 11:11:12 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53635) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cwrwZ-0004LM-Oa for qemu-devel@nongnu.org; Sat, 08 Apr 2017 11:06:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cwrwV-00048s-Kt for qemu-devel@nongnu.org; Sat, 08 Apr 2017 11:06:27 -0400 Received: from mail-pg0-x244.google.com ([2607:f8b0:400e:c05::244]:34282) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cwrwV-00048h-Em for qemu-devel@nongnu.org; Sat, 08 Apr 2017 11:06:23 -0400 Received: by mail-pg0-x244.google.com with SMTP id o123so20445403pga.1 for ; Sat, 08 Apr 2017 08:06:23 -0700 (PDT) Received: from localhost.localdomain.com ([117.224.174.65]) by smtp.gmail.com with ESMTPSA id 201sm15551374pfc.126.2017.04.08.08.06.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 08 Apr 2017 08:06:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=BHOnDM/tu1f6Tp5BD4QZ+xBAl9TxjRBoQQNpp+ayeDg=; b=uZnU1aM6iXZmU/+loCQa9rzHIQt12sJQASrFBF3I0DF9Wl+mmO5/aeWciGMmU8hg+J Bks6vRqekm0LiZX3OXLd4Lf1kkk8biYV2gwJ9+ckx1rNB57irbfhbeIksSg8Q7wldaXn 8oWM6afF+4TOnRkx81EziyQTWizuf1BXwqWyzxfrl4GnBIBB0182DNQbxqZOZAcjD6Ys YBH36Kp5KZsoVoR1Y7K9bSXZYTiesgdD2YE/EqcRlz/qmsOOOsNuPeGMhanA9ygqerPW pIyTORCuREbEZ8kLW8H9MQVxDDWYwIf65/vqBQbmABPsLmn/h1lrWjq6/D2SjBnia309 Burw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=BHOnDM/tu1f6Tp5BD4QZ+xBAl9TxjRBoQQNpp+ayeDg=; b=k6F3xzNaIzLWRiWpYbJAgLjzThB67nqlw+rxPbU1+jLoSptCyrAQwqnrbKdm2WxcFH m9gTMwlM07s7XoBVMISYH8XRgiqeuDUuLNwfjzBQ6GsRC4UbFziExJpmrkI7Ubjyeu2v r+VqN8DNWsN+VMHvXe56uH0wOrhdx6WoJvTN6bFE8kQuFXiOU/wKP/cyXJz7jUUVQTFR yyc6WAwCYsq1vzhogVqtkUHiBQf5W6zVvym+vZGYIGG2fnc8MLAOrus7pUJngwlWWi9I wRznFpu9ChRooSJqac7+ylO/0GXduOieaHP+9/AD+9AsZcVXMLZ8vMWIRBqYF5C9NQ0E 9jRw== X-Gm-Message-State: AN3rC/7DaiYSkW0X+5bw+FHWGzjTGOQW4Z74wUNP6XaBIgTa1q0wBI5B/QEAVr+P6aV5sg== X-Received: by 10.99.149.86 with SMTP id t22mr7307263pgn.154.1491663982559; Sat, 08 Apr 2017 08:06:22 -0700 (PDT) From: Suramya Shah To: qemu-devel@nongnu.org Date: Sat, 8 Apr 2017 20:35:24 +0530 Message-Id: <20170408150524.2870-1-shah.suramya@gmail.com> X-Mailer: git-send-email 2.9.3 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:400e:c05::244 Subject: [Qemu-devel] [PATCH] hw/core: fix segmentation fault X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Suramya Shah Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Reproducer: $i386-softmmu/qemu-system-i386 -S -machine isapc,accel=3Dtcg -device amd-i= ommu Segmentation fault (core dumped) Partial bt: #0 bus_add_child (child=3D0x555556d4e520, bus=3D0x0) at hw/core/qdev.c:88 #1 qdev_set_parent_bus (dev=3D0x555556d4e520, bus=3Dbus@entry=3D0x0) at hw/core/qdev.c:119 Signed-off-by: Suramya Shah --- 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 *ch= ild) { char name[32]; BusChild *kid =3D g_malloc0(sizeof(*kid)); - + =20 + if (!bus) { + error_report("bus not found "); + exit(0); + } kid->index =3D bus->max_index++; kid->child =3D child; object_ref(OBJECT(kid->child)); --=20 2.9.3