Skip to content

linux: Set number of devices to 0 in case of error

pci_sys is a global variable which is populated on init, and in case of error reading sysfs on Linux, the devices are NULL, but the number of devices is left unchanged.

As a result, we may crash in pci_device_next() which relies on the number of devices.

To fix the issue, simply reset the number of devices to zero in case of error so we don't try to access indices of a NULL array later on.

Signed-off-by: Olivier Fourdan ofourdan@redhat.com

Merge request reports