forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-01-04 1543e317f1da31b75942316931e8f491a8920811
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;