Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9083244pxu; Mon, 28 Dec 2020 06:13:55 -0800 (PST) X-Google-Smtp-Source: ABdhPJygDs8czbzA4K0KWP36/ucFnRHaFI93egPhccSAIbc99j8x2VRFJ3Q/qQf7FZgCxsJiHYfn X-Received: by 2002:a17:906:1796:: with SMTP id t22mr23764793eje.372.1609164835341; Mon, 28 Dec 2020 06:13:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609164835; cv=none; d=google.com; s=arc-20160816; b=FZ+m+DH2Y5d7mbAcplxT0KOX4DhjXkaeiWux/JzbzyU19GcsMgvJ5skjEm+bxiYpeP emaPPxP2GnVBKjqp/dBLe3sg+42EFwDFIg1Xztu5t8dLeWb0zdkeM7N0bD1OtWbn1Le6 p9/BHIJ354N8usdPMbtLQ0GQjckW4HcDo8RWgd0Yus1KmvgxFfXaSDcsPdidQjm+Cm4F V45HyCa/SY2Ia/IOuZXnScvCGg0aw4PLskVYgQ2XN98XU5c5ipwUZkdtDdMJufCFXq8O VpCKMevyC02cjBQ21/Hbl7A+s8b1DKyZsgqe1jTt4g6Xajgf0ZGGbvSjfRqB2CKV4R3r othw== 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=qZJmfPT8qe5dHQAdCkwfURedU0GXDGub9AzJw0euvQQ=; b=wYSxwr+862aPPQ0aHb3acaFEGDz/zBJe4bVhQ4jgkB7YfoByGqNHQ/TlqbDhK1XAJK s0KGD1EYSh1M1OFPfySn6vnJtQP6tpa9arrKcClxfa1yWNZCS6VT4ht70yrIc9TLpDxI 1vWwwvO5wVmJrHHLF3nQAM2tom9UitK5M4Nhieb68BbJts/+ZW+gCD5wBmxd0uqiI3Uh ekI9RLtCkCsIASgod9IU0JSf2e4uz3Kc0WZq3KwK+C9Sla6nArp4LS5eRaWOxsQ9zQ9c FSDL9sKpht7n6AhmaMezRA3Yssv9yKFmASS11ga9P12W6JHKKVCwHflamUp7jg9q3LQ9 gLfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Y2cZG2yU; 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 jz8si6433303ejb.237.2020.12.28.06.13.31; Mon, 28 Dec 2020 06:13:55 -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=Y2cZG2yU; 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 S2439693AbgL1OLg (ORCPT + 99 others); Mon, 28 Dec 2020 09:11:36 -0500 Received: from mail.kernel.org ([198.145.29.99]:46092 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2439679AbgL1OLb (ORCPT ); Mon, 28 Dec 2020 09:11:31 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 48EA1207AB; Mon, 28 Dec 2020 14:10:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609164651; bh=BPLJyYCj6LPWniZc0PkwrcuhXfUq2MC+pD3UGtF4CQw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Y2cZG2yUblyY5kQFMCnI1mGYHn1FWPBy9Va5SKof2fDItXj7Izsd0PQcphvgfkYtO 50NlzPG8diVLmX61CILcvKX51BlM2IHdj2H86jpBlOu8aNqTetnvwoW8fyILTC3d9m gdmK1yMISdgKf4UTlxgkwzRcbNo9pb9LFQxj34Rk= 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 5.10 242/717] PCI: iproc: Fix out-of-bound array accesses Date: Mon, 28 Dec 2020 13:44:00 +0100 Message-Id: <20201228125032.584145274@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228125020.963311703@linuxfoundation.org> References: <20201228125020.963311703@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/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 905e938082432..d901b9d392b8c 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.27.0