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]
Message-ID: <274037fa-b881-49bb-9e93-c83fefb80438@foss.st.com>
Date: Tue, 9 Dec 2025 09:52:41 +0100
From: Amelie Delaunay <amelie.delaunay@...s.st.com>
To: Dan Carpenter <dan.carpenter@...aro.org>,
        Amelie Delaunay
	<amelie.delaunay@...com>
CC: Kishon Vijay Abraham I <kishon@...nel.org>,
        Neil Armstrong
	<neil.armstrong@...aro.org>,
        <kernel-janitors@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
        Vinod Koul <vkoul@...nel.org>, <linux-arm-kernel@...ts.infradead.org>,
        Maxime Coquelin
	<mcoquelin.stm32@...il.com>,
        <linux-phy@...ts.infradead.org>,
        Fengguang Wu
	<fengguang.wu@...el.com>,
        <linux-stm32@...md-mailman.stormreply.com>,
        "Johan
 Hovold" <johan+linaro@...nel.org>
Subject: Re: [Linux-stm32] [PATCH] phy: stm32-usphyc: Fix off by one in
 probe()


On 12/9/25 07:53, Dan Carpenter wrote:
> The "index" variable is used as an index into the usbphyc->phys[] array
> which has usbphyc->nphys elements.  So if it is equal to usbphyc->nphys
> then it is one element out of bounds.  The "index" comes from the
> device tree so it's data that we trust and it's unlikely to be wrong,
> however it's obviously still worth fixing the bug.  Change the > to >=.
> 
> Fixes: 94c358da3a05 ("phy: stm32: add support for STM32 USB PHY Controller (USBPHYC)")
> Signed-off-by: Dan Carpenter <dan.carpenter@...aro.org>

Hi Dan, thanks for your patch.

Reviewed-by: Amelie Delaunay <amelie.delaunay@...s.st.com>

> ---
>   drivers/phy/st/phy-stm32-usbphyc.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/phy/st/phy-stm32-usbphyc.c b/drivers/phy/st/phy-stm32-usbphyc.c
> index 27fe92f73f33..b44afbff8616 100644
> --- a/drivers/phy/st/phy-stm32-usbphyc.c
> +++ b/drivers/phy/st/phy-stm32-usbphyc.c
> @@ -712,7 +712,7 @@ static int stm32_usbphyc_probe(struct platform_device *pdev)
>   		}
>   
>   		ret = of_property_read_u32(child, "reg", &index);
> -		if (ret || index > usbphyc->nphys) {
> +		if (ret || index >= usbphyc->nphys) {
>   			dev_err(&phy->dev, "invalid reg property: %d\n", ret);
>   			if (!ret)
>   				ret = -EINVAL;


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ