Blob Blame History Raw
From: Sebastian Ott <sebott@linux.ibm.com>
Date: Tue, 31 Jul 2018 09:59:09 -0400
Subject: s390/pci: improve bar check
Git-commit: e8e25a7718cf64701ddf7f7b2e31c79815b613f1
Patch-mainline: v5.1-rc1
References: jsc#SLE-5803 FATE#327056

Improve the bar check in pci_iomap_range to cover functions
for which we recognize more bars than what we can access due
to AR restrictions.

Signed-off-by: Sebastian Ott <sebott@linux.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Acked-by: Petr Tesarik <ptesarik@suse.com>
---
 arch/s390/pci/pci.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/arch/s390/pci/pci.c
+++ b/arch/s390/pci/pci.c
@@ -288,7 +288,7 @@ void __iomem *pci_iomap_range(struct pci
 	struct zpci_dev *zdev =	to_zpci(pdev);
 	int idx;
 
-	if (!pci_resource_len(pdev, bar))
+	if (!pci_resource_len(pdev, bar) || bar >= PCI_BAR_COUNT)
 		return NULL;
 
 	idx = zdev->bars[bar].map_idx;