Patchwork [RFC,v3,21/21] powerpc/pci: Fix crash with enabled movable BARs

login
register
mail settings
Submitter Sergey Miroshnichenko
Date Feb. 4, 2019, 3:36 p.m.
Message ID <20190204153601.7576-22-s.miroshnichenko@yadro.com>
Download mbox | patch
Permalink /patch/717481/
State New
Headers show

Comments

Sergey Miroshnichenko - Feb. 4, 2019, 3:36 p.m.
Check a resource for the UNSET flags.

Signed-off-by: Sergey Miroshnichenko <s.miroshnichenko@yadro.com>
---
 arch/powerpc/platforms/powernv/pci-ioda.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Patch

diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c
index 7db3119f8a5b..5354dfdf1028 100644
--- a/arch/powerpc/platforms/powernv/pci-ioda.c
+++ b/arch/powerpc/platforms/powernv/pci-ioda.c
@@ -3038,7 +3038,8 @@  static void pnv_ioda_setup_pe_res(struct pnv_ioda_pe *pe,
 	int index;
 	int64_t rc;
 
-	if (!res || !res->flags || res->start > res->end)
+	if (!res || !res->flags || res->start > res->end ||
+	    (res->flags & IORESOURCE_UNSET))
 		return;
 
 	if (res->flags & IORESOURCE_IO) {