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 From: David Gibson Date: Wed, 2 Nov 2011 13:49:05 +1100 Message-Id: <1320202145-27232-1-git-send-email-david@gibson.dropbear.id.au> Subject: [Qemu-devel] [PATCH] pseries: Fix initialization of sPAPREnvironment structure List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: anthony@codemonkey.ws, agraf@suse.de Cc: qemu-ppc@nongnu.org, qemu-devel@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 */ -- 1.7.7