[Skiboot] [PATCH] xive: Fix initialisation of xive_cpu_state struct

Andrew Donnellan andrew.donnellan at au1.ibm.com
Tue Jun 20 15:54:06 AEST 2017


When using XIVE emulation with DEBUG=1, we run into crashes in log_add()
due to the xive_cpu_state->log_pos being uninitialised (and thus, with
DEBUG enabled, initialised to the poison value of 0x99999999).

Zero out the xive_cpu_state to fix this.

Fixes: 6480d9656348 ("XIVE: Base XIVE support for OPAL XICS emulation calls")
Reported-by: Alastair D'Silva <alastair at d-silva.org>
Suggested-by: Benjamin Herrenschmidt <benh at kernel.crashing.org>
Signed-off-by: Andrew Donnellan <andrew.donnellan at au1.ibm.com>
---
 hw/xive.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hw/xive.c b/hw/xive.c
index eac8acbc..d69390ec 100644
--- a/hw/xive.c
+++ b/hw/xive.c
@@ -3057,6 +3057,7 @@ static void xive_init_cpu(struct cpu_thread *c)
 	/* Initialize the state structure */
 	c->xstate = xs = local_alloc(c->chip_id, sizeof(struct xive_cpu_state), 1);
 	assert(xs);
+	memset(xs, 0, sizeof(struct xive_cpu_state));
 	xs->xive = x;
 
 	init_lock(&xs->lock);
-- 
Andrew Donnellan              OzLabs, ADL Canberra
andrew.donnellan at au1.ibm.com  IBM Australia Limited



More information about the Skiboot mailing list