Return-Path: Received: from mail-bn3nam01on0094.outbound.protection.outlook.com ([104.47.33.94]:21055 "EHLO NAM01-BN3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933215AbeDIAjr (ORCPT ); Sun, 8 Apr 2018 20:39:47 -0400 From: Sasha Levin To: "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: Bjorn Helgaas , Sasha Levin Subject: [PATCH AUTOSEL for 3.18 024/101] PCI: Correct PCI_STD_RESOURCE_END usage Date: Mon, 9 Apr 2018 00:35:29 +0000 Message-ID: <20180409003505.164715-24-alexander.levin@microsoft.com> References: <20180409003505.164715-1-alexander.levin@microsoft.com> In-Reply-To: <20180409003505.164715-1-alexander.levin@microsoft.com> Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org List-ID: From: Bjorn Helgaas [ Upstream commit 2f686f1d9beee135de6d08caea707ec7bfc916d4 ] PCI_STD_RESOURCE_END is (confusingly) the index of the last valid BAR, not the *number* of BARs. To iterate through all possible BARs, we need to include PCI_STD_RESOURCE_END. Fixes: 9fe373f9997b ("PCI: Increase IBM ipr SAS Crocodile BARs to at least = system page size") Signed-off-by: Bjorn Helgaas Signed-off-by: Sasha Levin --- drivers/pci/quirks.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index b3e63f567c56..71536c16de9f 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c @@ -305,7 +305,7 @@ static void quirk_extend_bar_to_page(struct pci_dev *de= v) { int i; =20 - for (i =3D 0; i < PCI_STD_RESOURCE_END; i++) { + for (i =3D 0; i <=3D PCI_STD_RESOURCE_END; i++) { struct resource *r =3D &dev->resource[i]; =20 if (r->flags & IORESOURCE_MEM && resource_size(r) < PAGE_SIZE) { --=20 2.15.1