lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210212100856.473415-1-wasim.khan@oss.nxp.com>
Date:   Fri, 12 Feb 2021 11:08:56 +0100
From:   Wasim Khan <wasim.khan@....nxp.com>
To:     bhelgaas@...gle.com
Cc:     linux-pci@...r.kernel.org, linux-kernel@...r.kernel.org,
        Wasim Khan <wasim.khan@....com>
Subject: [PATCH] PCI : check if type 0 devices have all BARs of size zero

From: Wasim Khan <wasim.khan@....com>

Log a message if all BARs of type 0 devices are of
size zero. This can help detecting type 0 devices
not reporting BAR size correctly.

Signed-off-by: Wasim Khan <wasim.khan@....com>
---
 drivers/pci/probe.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 953f15abc850..6438d6d56777 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -321,6 +321,7 @@ int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type,
 static void pci_read_bases(struct pci_dev *dev, unsigned int howmany, int rom)
 {
 	unsigned int pos, reg;
+	bool found = false;
 
 	if (dev->non_compliant_bars)
 		return;
@@ -333,8 +334,12 @@ static void pci_read_bases(struct pci_dev *dev, unsigned int howmany, int rom)
 		struct resource *res = &dev->resource[pos];
 		reg = PCI_BASE_ADDRESS_0 + (pos << 2);
 		pos += __pci_read_base(dev, pci_bar_unknown, res, reg);
+		found |= res->flags ? 1 : 0;
 	}
 
+	if (!dev->hdr_type && !found)
+		pci_info(dev, "BAR size is 0 for BAR[0..%d]\n", howmany - 1);
+
 	if (rom) {
 		struct resource *res = &dev->resource[PCI_ROM_RESOURCE];
 		dev->rom_base_reg = rom;
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ