[PATCH pciutils] libpci: Fix intel_sanity_check() function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Function intel_sanity_check() calls conf1_read() which access d->domain
field. But intel_sanity_check() does not initialize this field and so
conf1_read() access some random data on stack.

Tests showed that intel_sanity_check() always fails as in d->domain is
stored some non-zero number.

Fix this issue by properly initializing struct pci_dev d and explicitly set
d->domain to zero in intel_sanity_check() as sanity check is verifying PCI
devices at domain 0.
---
 lib/i386-ports.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/i386-ports.c b/lib/i386-ports.c
index b3b752cb1f3f..b5e09dab6002 100644
--- a/lib/i386-ports.c
+++ b/lib/i386-ports.c
@@ -72,7 +72,9 @@ intel_sanity_check(struct pci_access *a, struct pci_methods *m)
 {
   struct pci_dev d;
 
+  memset(&d, 0, sizeof(d));
   a->debug("...sanity check");
+  d.domain = 0;
   d.bus = 0;
   d.func = 0;
   for (d.dev = 0; d.dev < 32; d.dev++)
-- 
2.20.1




[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux