lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Thu, 14 Feb 2019 13:22:08 +0100
From:   Marc Gonzalez <marc.w.gonzalez@...e.fr>
To:     Brian Masney <masneyb@...tation.org>, linus.walleij@...aro.org
Cc:     sboyd@...nel.org, lee.jones@...aro.org, andy.gross@...aro.org,
        david.brown@...aro.org, bjorn.andersson@...aro.org,
        linux-arm-msm@...r.kernel.org, linux-kernel@...r.kernel.org,
        linux-gpio@...r.kernel.org
Subject: Re: [PATCH -next 3/3] qcom: ssbi-gpio: correct boundary conditions in
 pm8xxx_domain_translate

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@...tation.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.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ