From: Marc Gonzalez <marc.w.gonzalez@free.fr>
To: Brian Masney <masneyb@onstation.org>, linus.walleij@linaro.org
Cc: sboyd@kernel.org, lee.jones@linaro.org, andy.gross@linaro.org,
david.brown@linaro.org, bjorn.andersson@linaro.org,
linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-gpio@vger.kernel.org
Subject: Re: [PATCH -next 3/3] qcom: ssbi-gpio: correct boundary conditions in pm8xxx_domain_translate
Date: Thu, 14 Feb 2019 13:22:08 +0100 [thread overview]
Message-ID: <82660bd6-200f-ec3a-cf78-9b6aec34f2a3@free.fr> (raw)
In-Reply-To: <20190214013641.9740-3-masneyb@onstation.org>
On 14/02/2019 02:36, Brian Masney wrote:
> SSBI GPIOs are numbered 1..ngpio, so the boundary check in
> pm8xxx_domain_translate() is off by one. This patch corrects that check.
>
> Signed-off-by: Brian Masney <masneyb@onstation.org>
> ---
> Originally found by Bjorn Andersson in spmi-gpio.
>
> Linus: For your ib-qcom-ssbi branch.
>
> drivers/pinctrl/qcom/pinctrl-ssbi-gpio.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/pinctrl/qcom/pinctrl-ssbi-gpio.c b/drivers/pinctrl/qcom/pinctrl-ssbi-gpio.c
> index 84a232450000..10575d6e2ba5 100644
> --- a/drivers/pinctrl/qcom/pinctrl-ssbi-gpio.c
> +++ b/drivers/pinctrl/qcom/pinctrl-ssbi-gpio.c
> @@ -710,7 +710,8 @@ static int pm8xxx_domain_translate(struct irq_domain *domain,
> struct pm8xxx_gpio *pctrl = container_of(domain->host_data,
> struct pm8xxx_gpio, chip);
>
> - if (fwspec->param_count != 2 || fwspec->param[0] >= pctrl->chip.ngpio)
> + if (fwspec->param_count != 2 || fwspec->param[0] < 1 ||
> + fwspec->param[0] > pctrl->chip.ngpio)
> return -EINVAL;
>
> *hwirq = fwspec->param[0] - PM8XXX_GPIO_PHYSICAL_OFFSET;
I would write (using the wrap-around behavior for unsigned int)
if (fwspec->param_count != 2 || fwspec->param[0] - 1 >= pctrl->chip.ngpio)
return -EINVAL;
Regards.
next prev parent reply other threads:[~2019-02-14 12:22 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-14 1:36 [PATCH -next 1/3] spmi: pmic-arb: select IRQ_DOMAIN_HIERARCHY in Kconfig Brian Masney
2019-02-14 1:36 ` [PATCH -next 2/3] mfd: pm8xxx: " Brian Masney
2019-02-14 8:17 ` Linus Walleij
2019-02-14 8:51 ` Lee Jones
2019-02-14 9:02 ` Linus Walleij
2019-02-14 1:36 ` [PATCH -next 3/3] qcom: ssbi-gpio: correct boundary conditions in pm8xxx_domain_translate Brian Masney
2019-02-14 8:18 ` Linus Walleij
2019-02-14 12:22 ` Marc Gonzalez [this message]
2019-02-14 1:54 ` [PATCH -next 1/3] spmi: pmic-arb: select IRQ_DOMAIN_HIERARCHY in Kconfig Randy Dunlap
2019-02-14 8:15 ` Linus Walleij
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=82660bd6-200f-ec3a-cf78-9b6aec34f2a3@free.fr \
--to=marc.w.gonzalez@free.fr \
--cc=andy.gross@linaro.org \
--cc=bjorn.andersson@linaro.org \
--cc=david.brown@linaro.org \
--cc=lee.jones@linaro.org \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=masneyb@onstation.org \
--cc=sboyd@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®