hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
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;