Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9043771pxu; Mon, 28 Dec 2020 05:15:34 -0800 (PST) X-Google-Smtp-Source: ABdhPJyZydw9uu6jr3FCxC9DGZIxOFPDi8lRiNJx+f7V5ij4kme/WjYVADh0Oz+4DiGvDoZBaNe2 X-Received: by 2002:a17:906:7784:: with SMTP id s4mr41817540ejm.93.1609161334714; Mon, 28 Dec 2020 05:15:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609161334; cv=none; d=google.com; s=arc-20160816; b=j+j/bEQ9KTEVH0bPG1IsBRHnMkZ4PfL0yw1+/1iIbae+5QHTd8lsJrgVQP/ygWq+R5 1jcq7gxq8QdAaSilvRgQfhwbqZ8Sg+yaRQ8Po/nDDPN/Fo/n2zYFT+k4F0wEUYaL5v3s mo8MySQwfK7mQyzeSyZBlJ00QdSa3BKOeB31JPuQt9qKCTu7VovGuygT+huQLtJABaVx bZx+9uK6Ojv5hNwHveStRdEw80d+vQJfD8lyWrg6Q82bur4T3W9VU+kz4NnjqlEkNfoS wGZw1gDBc6hNJuN4AUVGNlU3ouNWYkX2HWZuuUV9pKeXfNsXg00ZMRu1vbdfM3itJSMM cUYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=T5GjWcVjVDJMM2Y0CutD8mExFHN3whRDxRs/sh9ULWQ=; b=AfkbYS+ZqH7ifLnL0HJ2yESzH1J/DL6hFmGItcaowf414i1rkW7mI7dvUCzXI9TxlK xjasXAb4rp9t7CGWhMhrdNcNTlc832s3rXQegDrTYXMW7vseTHGYjIsp6+M4rEj2tPnK 7f7eIRW1YlJ20kEg4hSg8GnxGo7rH4h/v6UoG4MjUHOnnXAJbr8ZT0iOXPH49m1DdVHK xYsJ2WdcKqZuFVBt2jFL4KYU56B81msK/2Bo5ZhMHF2bwig18rfkoF1AemfXIME66fzl vjB02CFpaOQvv5Czo4fMj9qEKm70ZvjnnbaaEoSZGsNb5QaKMXaWGZDRYLgHpyCrbEzb NiUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="Dml43/Bp"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i12si19588639edk.461.2020.12.28.05.15.11; Mon, 28 Dec 2020 05:15:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="Dml43/Bp"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730187AbgL1NNS (ORCPT + 99 others); Mon, 28 Dec 2020 08:13:18 -0500 Received: from mail.kernel.org ([198.145.29.99]:41280 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732207AbgL1NNP (ORCPT ); Mon, 28 Dec 2020 08:13:15 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 1DE9D22AAA; Mon, 28 Dec 2020 13:12:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609161154; bh=QfsbsvBUQaN7YX5Yo3V4C7JbuS2Go+0I3tJcw22i5b4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Dml43/BpTbvF4UPf/yzwn4c5/kxVIsYstJVZIS0uj8rmrubEFgQizQdap6b7rosSq Fq/AtddcRYfguaJcGi8rac586xnfwU0s8ROFHX0rCn66og2zQs8aB4weDwRw50K/Um KQadHeYk0GhqkVgyQJsSxGEy5T971eraQe2NjhM4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bharat Gooty , Lorenzo Pieralisi , Sasha Levin Subject: [PATCH 4.14 120/242] PCI: iproc: Fix out-of-bound array accesses Date: Mon, 28 Dec 2020 13:48:45 +0100 Message-Id: <20201228124910.603364980@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228124904.654293249@linuxfoundation.org> References: <20201228124904.654293249@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Bharat Gooty [ Upstream commit a3ff529f5d368a17ff35ada8009e101162ebeaf9 ] 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 iproc_pcie_rev_init(). Link: https://lore.kernel.org/r/20201001060054.6616-2-srinath.mannam@broadcom.com Fixes: 06324ede76cdf ("PCI: iproc: Improve core register population") Signed-off-by: Bharat Gooty Signed-off-by: Lorenzo Pieralisi Signed-off-by: Sasha Levin --- drivers/pci/host/pcie-iproc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/pci/host/pcie-iproc.c b/drivers/pci/host/pcie-iproc.c index 8f8dac0155d63..2565abbe1a910 100644 --- a/drivers/pci/host/pcie-iproc.c +++ b/drivers/pci/host/pcie-iproc.c @@ -306,7 +306,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, @@ -317,7 +317,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, @@ -333,7 +333,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, @@ -361,7 +361,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, @@ -370,7 +370,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.27.0