Received: from eggs.gnu.org ([2001:4830:134:3::10]:43771) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bHZOr-0005Vm-C5 for qemu-devel@nongnu.org; Mon, 27 Jun 2016 12:28:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bHZOl-0003ZR-CB for qemu-devel@nongnu.org; Mon, 27 Jun 2016 12:28:40 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:13353 helo=mx0a-001b2d01.pphosted.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bHZOl-0003ZC-6z for qemu-devel@nongnu.org; Mon, 27 Jun 2016 12:28:35 -0400 Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.11/8.16.0.11) with SMTP id u5RGEAmF019347 for ; Mon, 27 Jun 2016 12:28:34 -0400 Received: from e34.co.us.ibm.com (e34.co.us.ibm.com [32.97.110.152]) by mx0b-001b2d01.pphosted.com with ESMTP id 23sm3tx3fe-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Mon, 27 Jun 2016 12:28:33 -0400 Received: from localhost by e34.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 27 Jun 2016 10:28:33 -0600 From: Greg Kurz Date: Mon, 27 Jun 2016 18:28:15 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <146704489509.8607.12236848738501803903.stgit@bahia.lan> Subject: [Qemu-devel] [PATCH] spapr: fix write-past-end-of-array error in cpu core device init code List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: David Gibson Cc: qemu-devel@nongnu.org, qemu-ppc@nongnu.org, Alexander Graf , bharata@linux.vnet.ibm.com This fixes a potential QEMU crash introduced by commit 3b542549661. Signed-off-by: Greg Kurz --- 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 3a5da09b9902..8b802a6fcf0b 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);