From patchwork Tue Sep 5 11:21:52 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prasad Pandit X-Patchwork-Id: 9938475 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 90558602B6 for ; Tue, 5 Sep 2017 11:24:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8333424B48 for ; Tue, 5 Sep 2017 11:24:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7818E28329; Tue, 5 Sep 2017 11:24:39 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0BF2524B48 for ; Tue, 5 Sep 2017 11:24:38 +0000 (UTC) Received: from localhost ([::1]:58184 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dpBy9-0001x8-Pj for patchwork-qemu-devel@patchwork.kernel.org; Tue, 05 Sep 2017 07:24:37 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49601) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dpBw1-0000uM-AU for qemu-devel@nongnu.org; Tue, 05 Sep 2017 07:22:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dpBvw-0005um-Ki for qemu-devel@nongnu.org; Tue, 05 Sep 2017 07:22:25 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39374) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dpBvj-0005f6-RA; Tue, 05 Sep 2017 07:22:07 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A443B7F3F6; Tue, 5 Sep 2017 11:22:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com A443B7F3F6 Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=ppandit@redhat.com Received: from localhost.localdomain (vpn2-54-49.bne.redhat.com [10.64.54.49]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 15CAD6BE6C; Tue, 5 Sep 2017 11:22:01 +0000 (UTC) From: P J P To: qemu-devel@nongnu.org Date: Tue, 5 Sep 2017 16:51:52 +0530 Message-Id: <20170905112152.8851-1-ppandit@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Tue, 05 Sep 2017 11:22:06 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH] intc: arm_gicv3: limit GICR ipriority index X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , qemu-arm@nongnu.org, Prasad J Pandit , Guoxiang Niu Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Prasad J Pandit When reading or writing to GICR ipriority array, index 'irq' could go beyond its bounds; Restrict it within array limits. Reported-by: Guoxiang Niu Signed-off-by: Prasad J Pandit --- hw/intc/arm_gicv3_redist.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/intc/arm_gicv3_redist.c b/hw/intc/arm_gicv3_redist.c index 77e5cfa327..7683c4cc7f 100644 --- a/hw/intc/arm_gicv3_redist.c +++ b/hw/intc/arm_gicv3_redist.c @@ -187,7 +187,7 @@ static MemTxResult gicr_readl(GICv3CPUState *cs, hwaddr offset, case GICR_ICACTIVER0: *data = gicr_read_bitmap_reg(cs, attrs, cs->gicr_iactiver0); return MEMTX_OK; - case GICR_IPRIORITYR ... GICR_IPRIORITYR + 0x1f: + case GICR_IPRIORITYR ... GICR_IPRIORITYR + 0x1c: { int i, irq = offset - GICR_IPRIORITYR; uint32_t value = 0; @@ -310,7 +310,7 @@ static MemTxResult gicr_writel(GICv3CPUState *cs, hwaddr offset, case GICR_ICACTIVER0: gicr_write_clear_bitmap_reg(cs, attrs, &cs->gicr_iactiver0, value); return MEMTX_OK; - case GICR_IPRIORITYR ... GICR_IPRIORITYR + 0x1f: + case GICR_IPRIORITYR ... GICR_IPRIORITYR + 0x1c: { int i, irq = offset - GICR_IPRIORITYR;