Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp2983464pxk; Tue, 15 Sep 2020 07:22:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwoM9Xeg7lKUMKDxkqrog5KLgpSbkzcyg2yKvhOgiR5mXPLAP0K4hp9mm2Rb4sSlTSabWWT X-Received: by 2002:a17:906:249b:: with SMTP id e27mr20163462ejb.105.1600179728534; Tue, 15 Sep 2020 07:22:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600179728; cv=none; d=google.com; s=arc-20160816; b=gbrNBBbbwZcgI3WqsI/GFy/+dIa+hZDx0b8Gbtym7FrdvL+6ZYZzUzATuSZ8KvC5qE aDnXANcECa91YgdeMREV5Waf+BbsqBeg+/iCLPe9r97dpKxNYhZvho7uqFB4kaC/8ABi 7nsVO6hpfMuUJkx7rnZrWJ/XRmfljbB3bTXlIGBUhFpgG+NWKok8VGjWItHmXIIGMjzz kmjvhci4YzGLs5D2FmJOxGmDZW0StTP5kJIPcF6WOJW2MQnHXEy+lSF60OIs2vOcYX1m P7XYilJpGs4ojcX1eTOm9na1sdNbn8WXOefWRnSe7fm/c8/ZvdLogP+G+aH4+CTCuM7j Jl6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=cdgo8gcr3yR5N+Dt3Xu3fyRafdoq6RtuY7MnOM9virM=; b=aFOvtviINFSkyaBTYjXTMY3SI1Y9lujE81Z2Eb/mNkeiqy+OgHNpK9otWBEJlJs/rM d47QSfTbdUjP6f92fBumPDhODPZlNjxk+tZn0K3byjjZyX+XNIb89lQwFMppk6+IhAHP xfHmSGTqih+K7idQ34SGdPUICnvmPMOspK+vgjLSoAxd0xeGWfKPgDQctjFXVOAfRQ2U rN//QRpdZUMBwYlbGJ1/mrcu8psCWL03CDPGsmdUIDWCMWsMvNIA8L1t0AXjBt9evo06 4F0FkGegJTATxqab2e0aVGu/V4LjMu5S9yzUw4YTIsd9CSZVuni0XDs0U70RQxk9gNNB M5Zg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=CnIPnbee; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id sd28si9486143ejb.302.2020.09.15.07.21.45; Tue, 15 Sep 2020 07:22:08 -0700 (PDT) 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=@broadcom.com header.s=google header.b=CnIPnbee; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726809AbgIOOSw (ORCPT + 99 others); Tue, 15 Sep 2020 10:18:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59300 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726812AbgIOOI2 (ORCPT ); Tue, 15 Sep 2020 10:08:28 -0400 Received: from mail-pj1-x1043.google.com (mail-pj1-x1043.google.com [IPv6:2607:f8b0:4864:20::1043]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C4C3C0611BC for ; Tue, 15 Sep 2020 06:46:16 -0700 (PDT) Received: by mail-pj1-x1043.google.com with SMTP id q4so1791072pjh.5 for ; Tue, 15 Sep 2020 06:46:16 -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=cdgo8gcr3yR5N+Dt3Xu3fyRafdoq6RtuY7MnOM9virM=; b=CnIPnbeegGCLMjvV+Ttrb9jnBV8d4g+3XEzFqqI9X4Aghu8tpkBVcG3p5uMt5R2ZAd u2nkvfVIrw2o1PoO3qi0fQy7d1TFoyU6yodsXUMq5rUBdlEThEiZxkHoI3p1evRL4Tp5 jQ2+6DoK9BcWRYZ7Yyk9O2wsiQaBnmlQee96E= 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=cdgo8gcr3yR5N+Dt3Xu3fyRafdoq6RtuY7MnOM9virM=; b=Jv0gal7r8aea9ngH73UV+zy+APwYogs7aR2X78znTDMN/IX35uKhdwXyedFhpPnVDw TlUbBW0S1F5qd8R5U4+HtR3OTg1LOX336M+w4H+iAOv0Fb1rDFvv8jx6HWmi0ZeQRSAH 8iUAcTJ76eThjmd0yD/OPSyxMAd0aVifvoMY0rGqsHvGsRAuWq6jRL0as08KQtov892Z TLqkrRaV3ONMTn5QkTP5xMkZNVxyismJxCkRYyOiCVFXbPI5RdWY7YOMHVbrPPLSgUFt /0rrL3ieV6Erkl7CcM6O9NrEGMGxQrqdXC3+X2/9kMHNivcX7y5qsxz3KAP1XxZAwWHy DZtg== X-Gm-Message-State: AOAM5300QMSM9mvaf0qSQS/vvzlBJ2NujbSXFYrxdZAoF0wpTb/ZNGBK Tx5FasDAKASmy/hpRPa8RRRC2w== X-Received: by 2002:a17:902:d693:b029:d1:bb0f:5f9d with SMTP id v19-20020a170902d693b02900d1bb0f5f9dmr14884498ply.30.1600177575714; Tue, 15 Sep 2020 06:46:15 -0700 (PDT) Received: from mannams-OptiPlex-7010.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id jz6sm12471478pjb.22.2020.09.15.06.46.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Sep 2020 06:46:15 -0700 (PDT) From: Srinath Mannam To: Lorenzo Pieralisi , Bjorn Helgaas , Ray Jui Cc: bcm-kernel-feedback-list@broadcom.com, linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Bharat Gooty Subject: [PATCH v2 1/3] PCI: iproc: fix out of bound array access Date: Tue, 15 Sep 2020 19:15:39 +0530 Message-Id: <20200915134541.14711-2-srinath.mannam@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200915134541.14711-1-srinath.mannam@broadcom.com> References: <20200915134541.14711-1-srinath.mannam@broadcom.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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 905e93808243..d901b9d392b8 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.17.1