]> mj.ucw.cz Git - pciutils.git/commit
lspci: Do not access config space when it is emulated
authorPali Rohár <pali@kernel.org>
Tue, 28 Dec 2021 19:29:21 +0000 (20:29 +0100)
committerMartin Mareš <mj@ucw.cz>
Fri, 15 Apr 2022 21:47:37 +0000 (23:47 +0200)
commit832b07a87c87f02cf17d748c075a84fc3a9b7afd
tree84c97dc0abdceca3da815aeacaaafd44dccdf9a8
parent26c8b543ef57deb98117a9155c48557baf04227b
lspci: Do not access config space when it is emulated

Emulated config space contains only few information so it could look like
some valid config space. libpci compose emulated config space either from
struct pci_dev or put some fake information (when struct pci_dev does not
have them).

To prevent showing to user fake/bogus information about PCI devices, show
only information which are directly stored in struct pci_dev when emulated
config space is used.

Do it via setting lspci's header type to invalid value (byte)-1, so lspci
code will handle device as unknown without trying to interpret values
config space. This header type is set only in lspci, not in libpci, so
other libpci applications would see valid config space.

lspci users are probably not interested in fake information provided by
libpci just for purpose to export syntactically valid config space.
Information stored in struct pci_dev are the correct one (or rather what OS
things that is correct).
ls-tree.c
lspci.c
lspci.h