forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-10-22 8ac6c7a54ed1b98d142dce24b11c6de6a1e239a5
kernel/drivers/net/phy/mdio_bus.c
....@@ -108,7 +108,12 @@
108108
109109 struct phy_device *mdiobus_get_phy(struct mii_bus *bus, int addr)
110110 {
111
- struct mdio_device *mdiodev = bus->mdio_map[addr];
111
+ struct mdio_device *mdiodev;
112
+
113
+ if (addr < 0 || addr >= ARRAY_SIZE(bus->mdio_map))
114
+ return NULL;
115
+
116
+ mdiodev = bus->mdio_map[addr];
112117
113118 if (!mdiodev)
114119 return NULL;