phy: hisilicon: Fix an out of bounds check in hisi_inno_phy_probe()
stable inclusion from stable-v5.10.190 commit ad249aa3c38f329f91fba8b4b3cd087e79fb0ce8 category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I928UI Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=ad249aa3c38f329f91fba8b4b3cd087e79fb0ce8 -------------------------------- [ Upstream commit 13c088cf ] The size of array 'priv->ports[]' is INNO_PHY_PORT_NUM. In the for loop, 'i' is used as the index for array 'priv->ports[]' with a check (i > INNO_PHY_PORT_NUM) which indicates that INNO_PHY_PORT_NUM is allowed value for 'i' in the same loop. This > comparison needs to be changed to >=, otherwise it potentially leads to an out of bounds write on the next iteration through the loop Fixes: ba8b0ee8 ("phy: add inno-usb2-phy driver for hi3798cv200 SoC") Reported-by:Dan Carpenter <dan.carpenter@linaro.org> Signed-off-by:
Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com> Link: https://lore.kernel.org/r/20230721090558.3588613-1-harshit.m.mogalapalli@oracle.com Signed-off-by:
Vinod Koul <vkoul@kernel.org> Signed-off-by:
Sasha Levin <sashal@kernel.org> Signed-off-by:
sanglipeng <sanglipeng1@jd.com>
Loading
Please sign in to comment