From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6511DC2D0E7 for ; Thu, 26 Mar 2020 07:08:22 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 22DC820838 for ; Thu, 26 Mar 2020 07:08:22 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="C0CAIoIq"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="NkGvO6uY" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 22DC820838 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=broadcom.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=XnjlWdiqB2DBkwBSPZudeGSvF+w7FAHHZJ1HT2pB8tE=; b=C0CAIoIqbuuqguVDtKTWfdd6ff tFaFNVHY08Vs33DJ/khDVdqtPuMkdlxcT9mWlweCsTPPRXryZmFM5B6PFm48/HB7EDC1IDoeAmThE vTtBtSRCsdMUZ6+qfOudlPpwkIo4szWxyZw4AUBC8vCckAKuWf9d2nVuXmUTM0NgToHANqd+GdbN2 547X8dyznvQswchpj55rCNEOdw6iSlh4rjxfbIdmuv5QgEOfMt7fLhc4jrMUTTl2PmxPjV8esgjbK /i+2SOO+fciN2LFazf1eSer3IisB9wIrB6CrdnCSR2N9mvzmMlvU+7dU5/sjfKrOyn7ioFycdE2aZ Y0Vb7VbQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jHMcj-0007zk-Q7; Thu, 26 Mar 2020 07:08:17 +0000 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jHMcW-0007pG-LF for linux-arm-kernel@lists.infradead.org; Thu, 26 Mar 2020 07:08:06 +0000 Received: by mail-wr1-x443.google.com with SMTP id m11so489791wrx.10 for ; Thu, 26 Mar 2020 00:08:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=afg8dNB66EeO23R6bSZJHyegs9ORKcUpXptgDs7UTws=; b=NkGvO6uYSAMxMcb9P0RAg0D3yHckMsjCJgy81OSyDdL8EF5sHoZxsihiKBUJYqIQO0 FkmG1UfasybW7KR8tmBkKkkF3pTqzVP3/mgrEq2721W34udH76Kg/t0NKLtbP6vyBlpc 0zMeDxmnwXlItGBygP6bdmXi34qI8MUNpDSm0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=afg8dNB66EeO23R6bSZJHyegs9ORKcUpXptgDs7UTws=; b=b1ueY0vBcOqVm7np+qhWFIA6ikBkinZGJsEurPQMpKbGfdm7xhkg5QIxgQ3mKYok9q i+Fk/lAINKkVZIJpF1YlsYUo6vOw9Qxxz2rTll+G1halU9a0PpVt2kN+wc1Cy5wiMOSz W0miubg11h4G6LODXRn+mFk/NFsfe1bFcltOyZ5g5Ktctm2oL7xyFm39od2S5CDIeeA7 9eBaOcDbChiu6r740aNCuW2R3w2U2U0fgHM9KuAQpzZ+NnRTHDvCqtPoIVB1ZJUzIYTR GFajPNz77sou8kGuQT1JRXyOtpgO+UDIwJiXpiZDfUs01BJa/gjjbvUxQM3l2WfiSYkq yRsw== X-Gm-Message-State: ANhLgQ1ZSHzsLNUGHGxy35OysvoEyf7NYLuzM25LXnWVJWZqrK2seNbZ yMeMDs64cTdbWyMIDi6MR1xlmQ== X-Google-Smtp-Source: ADFU+vs4AXz8FI0fPBQ54wsPqGouqEqXUvwleEGkLy2ntX9wK7IYngl27SxZG3aUl2DSzFShBbL0tA== X-Received: by 2002:adf:e68b:: with SMTP id r11mr7161551wrm.138.1585206483395; Thu, 26 Mar 2020 00:08:03 -0700 (PDT) Received: from mannams-OptiPlex-7010.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id u8sm2129446wrn.69.2020.03.26.00.07.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 26 Mar 2020 00:08:02 -0700 (PDT) From: Srinath Mannam To: Lorenzo Pieralisi , Bjorn Helgaas , Florian Fainelli , Ray Jui , Andrew Murray Subject: [PATCH 1/3] PCI: iproc: fix out of bound array access Date: Thu, 26 Mar 2020 12:37:25 +0530 Message-Id: <1585206447-1363-2-git-send-email-srinath.mannam@broadcom.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1585206447-1363-1-git-send-email-srinath.mannam@broadcom.com> References: <1585206447-1363-1-git-send-email-srinath.mannam@broadcom.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200326_000804_744372_55D5239F X-CRM114-Status: GOOD ( 13.87 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-pci@vger.kernel.org, bcm-kernel-feedback-list@broadcom.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Bharat Gooty MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Bharat Gooty Declare the full size array for all revisions of PAX register sets to avoid potentially out of bound access of the register array when they are being initialized in the 'iproc_pcie_rev_init' function. Fixes: 06324ede76cdf ("PCI: iproc: Improve core register population") Signed-off-by: Bharat Gooty --- drivers/pci/controller/pcie-iproc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/pci/controller/pcie-iproc.c b/drivers/pci/controller/pcie-iproc.c index 0a468c7..6972ca4 100644 --- a/drivers/pci/controller/pcie-iproc.c +++ b/drivers/pci/controller/pcie-iproc.c @@ -307,7 +307,7 @@ enum iproc_pcie_reg { }; /* iProc PCIe PAXB BCMA registers */ -static const u16 iproc_pcie_reg_paxb_bcma[] = { +static const u16 iproc_pcie_reg_paxb_bcma[IPROC_PCIE_MAX_NUM_REG] = { [IPROC_PCIE_CLK_CTRL] = 0x000, [IPROC_PCIE_CFG_IND_ADDR] = 0x120, [IPROC_PCIE_CFG_IND_DATA] = 0x124, @@ -318,7 +318,7 @@ static const u16 iproc_pcie_reg_paxb_bcma[] = { }; /* iProc PCIe PAXB registers */ -static const u16 iproc_pcie_reg_paxb[] = { +static const u16 iproc_pcie_reg_paxb[IPROC_PCIE_MAX_NUM_REG] = { [IPROC_PCIE_CLK_CTRL] = 0x000, [IPROC_PCIE_CFG_IND_ADDR] = 0x120, [IPROC_PCIE_CFG_IND_DATA] = 0x124, @@ -334,7 +334,7 @@ static const u16 iproc_pcie_reg_paxb[] = { }; /* iProc PCIe PAXB v2 registers */ -static const u16 iproc_pcie_reg_paxb_v2[] = { +static const u16 iproc_pcie_reg_paxb_v2[IPROC_PCIE_MAX_NUM_REG] = { [IPROC_PCIE_CLK_CTRL] = 0x000, [IPROC_PCIE_CFG_IND_ADDR] = 0x120, [IPROC_PCIE_CFG_IND_DATA] = 0x124, @@ -363,7 +363,7 @@ static const u16 iproc_pcie_reg_paxb_v2[] = { }; /* iProc PCIe PAXC v1 registers */ -static const u16 iproc_pcie_reg_paxc[] = { +static const u16 iproc_pcie_reg_paxc[IPROC_PCIE_MAX_NUM_REG] = { [IPROC_PCIE_CLK_CTRL] = 0x000, [IPROC_PCIE_CFG_IND_ADDR] = 0x1f0, [IPROC_PCIE_CFG_IND_DATA] = 0x1f4, @@ -372,7 +372,7 @@ static const u16 iproc_pcie_reg_paxc[] = { }; /* iProc PCIe PAXC v2 registers */ -static const u16 iproc_pcie_reg_paxc_v2[] = { +static const u16 iproc_pcie_reg_paxc_v2[IPROC_PCIE_MAX_NUM_REG] = { [IPROC_PCIE_MSI_GIC_MODE] = 0x050, [IPROC_PCIE_MSI_BASE_ADDR] = 0x074, [IPROC_PCIE_MSI_WINDOW_SIZE] = 0x078, -- 2.7.4 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel