From: "Theo de Raadt" Subject: Re: infinite loop in pcidump To: Miod Vallat Cc: tech@openbsd.org Date: Sat, 29 Aug 2026 20:50:32 -0600 Looks obvious to me. Miod Vallat wrote: > I have a PCIe device here, with the whole PCIe configuration space > read returning all bits set to one (i.e. 0xffffffff). > > When running pcidump -v on this device, I get this: > > [...] > 0x0100: Enhanced Capability 0xffff: Unknown > 0x0ffc: Enhanced Capability 0xffff: Unknown > 0x0ffc: Enhanced Capability 0xffff: Unknown > 0x0ffc: Enhanced Capability 0xffff: Unknown > 0x0ffc: Enhanced Capability 0xffff: Unknown > [ ad nauseam ] > > The following diff tries to recognize this and break from the loop. > > Index: pcidump.c > =================================================================== > RCS file: /OpenBSD/src/usr.sbin/pcidump/pcidump.c,v > diff -u -p -r1.73 pcidump.c > --- pcidump.c 25 Dec 2025 10:59:26 -0000 1.73 > +++ pcidump.c 29 Aug 2026 05:12:14 -0000 > @@ -675,6 +675,9 @@ dump_pcie_enhanced_caplist(int bus, int > if (pci_read(bus, dev, func, ptr, ®) != 0) > return; > > + if (reg == 0xffffffffU) > + return; > + > if (PCI_PCIE_ECAP_ID(reg) == 0xffff && > PCI_PCIE_ECAP_NEXT(reg) == PCI_PCIE_ECAP_LAST) > return; >