mirror of
https://github.com/openwrt/openwrt.git
synced 2026-06-17 14:50:15 +04:00
realtek: mdio: harden phy address check
As of now RTL839x devices have never more than 32 devices on one mdio bus. Harden the phy address check during probing. Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de> Link: https://github.com/openwrt/openwrt/pull/23186 Signed-off-by: Robert Marko <robimarko@gmail.com>
This commit is contained in:
committed by
Robert Marko
parent
593df57731
commit
41e9574297
@@ -916,8 +916,7 @@ static int rtmdio_map_ports(struct device *dev)
|
||||
return dev_err_probe(dev, -EINVAL, "%pfwP no phy address\n",
|
||||
of_fwnode_handle(phy));
|
||||
|
||||
/* relaxed check as RTL839x uses MDIO addresses 0..51 */
|
||||
if (smi_addr >= ctrl->cfg->num_phys)
|
||||
if (smi_addr >= PHY_MAX_ADDR)
|
||||
return dev_err_probe(dev, -EINVAL, "%pfwP illegal phy address\n",
|
||||
of_fwnode_handle(phy));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user