From: David Gibson Date: Tue, 1 Nov 2011 16:49:05 +0000 (+0000) Subject: pseries: Fix initialization of sPAPREnvironment structure X-Git-Tag: qemu-xen-4.2.0~114^2~6^2~8 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=d43b45e220ae82081e389ae113f6f03d9294fdcf;p=qemu-xen.git pseries: Fix initialization of sPAPREnvironment structure 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 Signed-off-by: Alexander Graf --- diff --git a/hw/spapr.c b/hw/spapr.c index bdaa938b6b..40cfc9be1f 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 */