From dde35bc966ef8c1afb4f4e0f3c0e99fc0f27ca04 Mon Sep 17 00:00:00 2001 From: Greg Kurz Date: Mon, 27 Jun 2016 18:28:15 +0200 Subject: [PATCH] spapr: fix write-past-end-of-array error in cpu core device init code This fixes a potential QEMU crash introduced by commit 3b542549661. Signed-off-by: Greg Kurz Signed-off-by: David Gibson --- hw/ppc/spapr_cpu_core.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/hw/ppc/spapr_cpu_core.c b/hw/ppc/spapr_cpu_core.c index 3a5da09b99..8b802a6fcf 100644 --- a/hw/ppc/spapr_cpu_core.c +++ b/hw/ppc/spapr_cpu_core.c @@ -309,10 +309,9 @@ static void spapr_cpu_core_realize(DeviceState *dev, Error **errp) } err: - while (i >= 0) { + while (--i >= 0) { obj = sc->threads + i * size; object_unparent(obj); - i--; } g_free(sc->threads); error_propagate(errp, local_err); -- 2.11.4.GIT