Re: infinite loop in pcidump

"Theo de Raadt" <[email protected]>
Newsgroups gmane.os.openbsd.tech
Message-ID <[email protected]>
Looks obvious to me.

Miod Vallat <[email protected]> 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, &reg) != 0)
>  			return;
>  
> +		if (reg == 0xffffffffU)
> +			return;
> +
>  		if (PCI_PCIE_ECAP_ID(reg) == 0xffff &&
>  		    PCI_PCIE_ECAP_NEXT(reg) == PCI_PCIE_ECAP_LAST)
>  			return;
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.