From patchwork Wed Nov 2 02:49:05 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Gibson X-Patchwork-Id: 123204 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 50B28B6F7F for ; Wed, 2 Nov 2011 13:49:47 +1100 (EST) Received: from localhost ([::1]:60150 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RLQtY-0005Ak-Ul for incoming@patchwork.ozlabs.org; Tue, 01 Nov 2011 22:49:40 -0400 Received: from eggs.gnu.org ([140.186.70.92]:34235) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RLQtS-00059M-V8 for qemu-devel@nongnu.org; Tue, 01 Nov 2011 22:49:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RLQtR-0005Fe-Rd for qemu-devel@nongnu.org; Tue, 01 Nov 2011 22:49:34 -0400 Received: from ozlabs.org ([203.10.76.45]:57960) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RLQtR-0005FO-EK; Tue, 01 Nov 2011 22:49:33 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id D28A8B6F7F; Wed, 2 Nov 2011 13:49:31 +1100 (EST) From: David Gibson To: anthony@codemonkey.ws, agraf@suse.de Date: Wed, 2 Nov 2011 13:49:05 +1100 Message-Id: <1320202145-27232-1-git-send-email-david@gibson.dropbear.id.au> X-Mailer: git-send-email 1.7.7 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 203.10.76.45 Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org Subject: [Qemu-devel] [PATCH] pseries: Fix initialization of sPAPREnvironment structure X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Since we added PCI support to the pseries machine, we include a qlist of PCI host bridges in the sPAPREnvironment structure. However this list was never properly initialized it. Somehow we got away with this until some other recent change broke it, and we now segfault immediately on startup. This patch adds the required QLIST_INIT(), and while we're at it makes sure we initialize the rest of the sPAPREnvironment structure to 0, to avoid future nasty surprises. Signed-off-by: David Gibson --- hw/spapr.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/hw/spapr.c b/hw/spapr.c index bdaa938..40cfc9b 100644 --- a/hw/spapr.c +++ b/hw/spapr.c @@ -407,7 +407,9 @@ static void ppc_spapr_init(ram_addr_t ram_size, long pteg_shift = 17; char *filename; - spapr = g_malloc(sizeof(*spapr)); + spapr = g_malloc0(sizeof(*spapr)); + QLIST_INIT(&spapr->phbs); + cpu_ppc_hypercall = emulate_spapr_hypercall; /* Allocate RMA if necessary */