qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] pseries: Fix initialization of sPAPREnvironment structure
@ 2011-11-02  2:49 David Gibson
  0 siblings, 0 replies; only message in thread
From: David Gibson @ 2011-11-02  2:49 UTC (permalink / raw)
  To: anthony, agraf; +Cc: qemu-ppc, qemu-devel

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 <david@gibson.dropbear.id.au>
---
 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

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2011-11-02  2:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-02  2:49 [Qemu-devel] [PATCH] pseries: Fix initialization of sPAPREnvironment structure David Gibson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).