All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] qcom: spmi-gpio: Fix boundary conditions IRQ domain translate
@ 2019-02-12  3:52 Bjorn Andersson
  2019-02-12 10:08 ` Brian Masney
  2019-02-13  8:19 ` Linus Walleij
  0 siblings, 2 replies; 3+ messages in thread
From: Bjorn Andersson @ 2019-02-12  3:52 UTC (permalink / raw)
  To: Bjorn Andersson, Linus Walleij, Brian Masney
  Cc: linux-arm-msm, linux-gpio, linux-kernel

GPIOs on the SPMI PMIC are numbered 1..ngpio, so the boundary check in
pmic_gpio_domain_translate() is off by one, correct this.

Fixes: ca69e2d165eb ("qcom: spmi-gpio: add support for hierarchical IRQ chip")
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
---
 drivers/pinctrl/qcom/pinctrl-spmi-gpio.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c b/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c
index e01a556ac586..cb512c7a5251 100644
--- a/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c
+++ b/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c
@@ -962,7 +962,8 @@ static int pmic_gpio_domain_translate(struct irq_domain *domain,
 						     struct pmic_gpio_state,
 						     chip);
 
-	if (fwspec->param_count != 2 || fwspec->param[0] >= state->chip.ngpio)
+	if (fwspec->param_count != 2 ||
+	    fwspec->param[0] < 1 || fwspec->param[0] > state->chip.ngpio)
 		return -EINVAL;
 
 	*hwirq = fwspec->param[0] - PMIC_GPIO_PHYSICAL_OFFSET;
-- 
2.18.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] qcom: spmi-gpio: Fix boundary conditions IRQ domain translate
  2019-02-12  3:52 [PATCH] qcom: spmi-gpio: Fix boundary conditions IRQ domain translate Bjorn Andersson
@ 2019-02-12 10:08 ` Brian Masney
  2019-02-13  8:19 ` Linus Walleij
  1 sibling, 0 replies; 3+ messages in thread
From: Brian Masney @ 2019-02-12 10:08 UTC (permalink / raw)
  To: Bjorn Andersson; +Cc: Linus Walleij, linux-arm-msm, linux-gpio, linux-kernel

On Mon, Feb 11, 2019 at 07:52:05PM -0800, Bjorn Andersson wrote:
> GPIOs on the SPMI PMIC are numbered 1..ngpio, so the boundary check in
> pmic_gpio_domain_translate() is off by one, correct this.
> 
> Fixes: ca69e2d165eb ("qcom: spmi-gpio: add support for hierarchical IRQ chip")
> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>

Reviewed-by: Brian Masney <masneyb@onstation.org>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] qcom: spmi-gpio: Fix boundary conditions IRQ domain translate
  2019-02-12  3:52 [PATCH] qcom: spmi-gpio: Fix boundary conditions IRQ domain translate Bjorn Andersson
  2019-02-12 10:08 ` Brian Masney
@ 2019-02-13  8:19 ` Linus Walleij
  1 sibling, 0 replies; 3+ messages in thread
From: Linus Walleij @ 2019-02-13  8:19 UTC (permalink / raw)
  To: Bjorn Andersson
  Cc: Brian Masney, linux-arm-msm, open list:GPIO SUBSYSTEM, linux-kernel

On Tue, Feb 12, 2019 at 4:52 AM Bjorn Andersson
<bjorn.andersson@linaro.org> wrote:

> GPIOs on the SPMI PMIC are numbered 1..ngpio, so the boundary check in
> pmic_gpio_domain_translate() is off by one, correct this.
>
> Fixes: ca69e2d165eb ("qcom: spmi-gpio: add support for hierarchical IRQ chip")
> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>

Good catch! Patch applied with Brian's review tag.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-02-13  8:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-12  3:52 [PATCH] qcom: spmi-gpio: Fix boundary conditions IRQ domain translate Bjorn Andersson
2019-02-12 10:08 ` Brian Masney
2019-02-13  8:19 ` Linus Walleij

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.