s390/pci: improve bar check
authorSebastian Ott <sebott@linux.ibm.com>
Tue, 31 Jul 2018 13:59:09 +0000 (09:59 -0400)
committerMartin Schwidefsky <schwidefsky@de.ibm.com>
Thu, 7 Feb 2019 10:57:04 +0000 (11:57 +0100)
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>
arch/s390/pci/pci.c

index a966d7b..353161c 100644 (file)
@@ -285,7 +285,7 @@ void __iomem *pci_iomap_range(struct pci_dev *pdev,
        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;