From d61c47722516d1955c4e7176d738b54a762f9343 Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Sat, 16 Jan 2010 12:10:09 +0100 Subject: [PATCH] Avoid unaligned accesses to extended capabilities. The PCIe spec tells that all capabilities must be DWORD aligned and the bottom 2 bits of all capability pointers are reserved for future use and must be ignored when read. Should fix Mandriva bug #56772. --- lib/caps.c | 2 +- ls-ecaps.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/caps.c b/lib/caps.c index 19e04d5..ff4d9c4 100644 --- a/lib/caps.c +++ b/lib/caps.c @@ -71,7 +71,7 @@ pci_scan_ext_caps(struct pci_dev *d) if (been_there[where]++) break; pci_add_cap(d, where, id, PCI_CAP_EXTENDED); - where = header >> 20; + where = (header >> 20) & ~3; } while (where); } diff --git a/ls-ecaps.c b/ls-ecaps.c index 0d14b7f..7888214 100644 --- a/ls-ecaps.c +++ b/ls-ecaps.c @@ -284,6 +284,6 @@ show_ext_caps(struct device *d) printf("#%02x\n", id); break; } - where = header >> 20; + where = (header >> 20) & ~3; } while (where); } -- 2.39.2