PCI: Follow-up fix for BAR hardening
PATCH 1/1 PCI: Follow-up fix for BAR hardening
Fixes a bug where variables were used before being initialized.
To be squashed into commit "PCI: Check BAR index for validity"
Signed-off-by Philipp Stanner <[email protected]>
---
Fix for this already applied patch:
https://lore.kernel.org/all/[email protected]/
--- drivers/pci/iomap.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/pci/iomap.c +5 -4
@@ -40,13 +40,14 @@ void __iomem *pci_iomap_range(struct pci_dev *dev,if (!pci_bar_index_is_valid (bar))return NULL ; -if (len <= offset || !start) -return NULL ; start =pci_resource_start (dev, bar); len =pci_resource_len (dev, bar); flags =pci_resource_flags (dev, bar); +if (len <= offset || !start) +return NULL ; + len -= offset; start += offset;if (maxlen && len > maxlen)
@@ -90,13 +91,13 @@ void __iomem *pci_iomap_wc_range(struct pci_dev *dev,if (!pci_bar_index_is_valid (bar))return NULL ; -if (len <= offset || !start) -return NULL ; start =pci_resource_start (dev, bar); len =pci_resource_len (dev, bar); flags =pci_resource_flags (dev, bar); +if (len <= offset || !start) +return NULL ;if (flags &IORESOURCE_IO )return NULL ;
Signature · 1 line
2.48.1
Hello,
Quoted 3 lines
Fixes a bug where variables were used before being initialized.
To be squashed into commit "PCI: Check BAR index for validity"
Squashed against the existing code on the branch. Have a look:
Thank you!
Krzysztof