When an interrupt-map contains multiple entries an imap pointer arithmetic
bug can cause only the first entry to be properly evaluated and causes
the out_irq parameters to be incorrect depending on the #interrupt-cells
and #address-cells of the parent interrupt controller.

Specifically, the imap pointer into the interrupt-map table should be
adjusted by the parent interrupt controller #interrupt-cells size only
as at this point the only the parent unit interrupt specifier needs to be
stepped over.

This resolves an issue encountered when using the of_irq_parse_and_map_pci()
for the imx6 pcie host controller driver map_irq function where a P2P bridge
is on the bus and legacy PCI interrupts are to be used.

Signed-off-by: Tim Harvey <[email protected]>
Cc: Jason Gunthorpe <[email protected]>
Cc: Jingoo Han <[email protected]>
Cc: Lucas Stach <[email protected]>
Cc: Mark Rutland <[email protected]>
Cc: linux-samsung-soc <[email protected]>
Cc: Richard Zhu <[email protected]>
Cc: Sascha Hauer <[email protected]>
Cc: Arnd Bergmann <[email protected]>
Cc: Stephen Warren <[email protected]>
Cc: Bjorn Helgaas <[email protected]>
Cc: Simon Horman <[email protected]>
Cc: Thierry Reding <[email protected]>
Cc: Ben Dooks <[email protected]>
Cc: linux-tegra <[email protected]>
Cc: Kukjin Kim <[email protected]>
Cc: Shawn Guo <[email protected]>
Cc: Grant Likely <[email protected]>
---
 drivers/of/irq.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/of/irq.c b/drivers/of/irq.c
index 9bcf2cf..8829197 100644
--- a/drivers/of/irq.c
+++ b/drivers/of/irq.c
@@ -237,11 +237,11 @@ int of_irq_parse_raw(const __be32 *addr, struct 
of_phandle_args *out_irq)
                        /* Check for malformed properties */
                        if (WARN_ON(newaddrsize + newintsize > 
MAX_PHANDLE_ARGS))
                                goto fail;
-                       if (imaplen < (newaddrsize + newintsize))
+                       if (imaplen < newintsize)
                                goto fail;
 
-                       imap += newaddrsize + newintsize;
-                       imaplen -= newaddrsize + newintsize;
+                       imap += newintsize;
+                       imaplen -= newintsize;
 
                        pr_debug(" -> imaplen=%d\n", imaplen);
                }
-- 
1.8.3.2

--
To unsubscribe from this list: send the line "unsubscribe linux-tegra" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to