linux/drivers/phy/st
Dan Carpenter b91c9f6bfb phy: stm32-usphyc: Fix off by one in probe()
[ Upstream commit cabd25b572 ]

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: 94c358da3a ("phy: stm32: add support for STM32 USB PHY Controller (USBPHYC)")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Amelie Delaunay <amelie.delaunay@foss.st.com>
Link: https://patch.msgid.link/aTfHcMJK1wFVnvEe@stanley.mountain
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
History 2026-01-23 11:18:41 +01:00
..
Kconfig phy: stm32: register usbphyc as clock provider of ck_usbo_48m clock 2021-03-15 15:25:29 +05:30
Makefile treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
phy-miphy28lp.c phy: miphy28lp: remove unused struct 'miphy_initval' 2024-06-03 19:29:44 +05:30
phy-spear1310-miphy.c phy: constify of_phandle_args in xlate 2024-02-23 17:43:14 +05:30
phy-spear1340-miphy.c phy: constify of_phandle_args in xlate 2024-02-23 17:43:14 +05:30
phy-stih407-usb.c phy: drop probe registration printks 2026-01-23 11:18:41 +01:00
phy-stm32-usbphyc.c phy: stm32-usphyc: Fix off by one in probe() 2026-01-23 11:18:41 +01:00