net: mdio: warn once if addr parameter is invalid in mdiobus_get_phy()
Subsystems (3)
Heiner Kallweit
maintainerPATCH 1/1 net: mdio: warn once if addr parameter is invalid in mdiobus_get_phy()
If mdiobus_get_phy() is called with an invalid addr parameter, then the caller has a bug. Print a call trace to help identifying the caller.
--- drivers/net/phy/mdio_bus.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/phy/mdio_bus.c +2 -1
@@ -108,9 +108,10 @@ EXPORT_SYMBOL(mdiobus_unregister_device);struct phy_device *mdiobus_get_phy (struct mii_bus *bus,int addr) { +bool addr_valid = addr >=0 && addr <ARRAY_SIZE (bus->mdio_map);struct mdio_device *mdiodev; -if (addr <0 || addr >=ARRAY_SIZE (bus->mdio_map)) +if (WARN_ONCE (!addr_valid,"addr %d out of range\n" , addr))return NULL ; mdiodev = bus->mdio_map[addr];
Signature · 1 line
2.39.0
Quoted 5 lines · Heiner Kallweit
If
mdiobus_get_phy()is called with an invalid addr parameter, then the caller has a bug. Print a call trace to help identifying the caller.Suggested-by Paolo Abeni <[email protected]>Signed-off-by Heiner Kallweit <[email protected]>
Andrew
This patch was applied to netdev/net-next.git (master) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net-next.git (master) by Jakub Kicinski <[email protected]>:
Quoted 8 lines · On Fri, 20 Jan 2023 23:18:32 +0100 you wrote:
If
mdiobus_get_phy()is called with an invalid addr parameter, then the caller has a bug. Print a call trace to help identifying the caller.Suggested-by Paolo Abeni <[email protected]>Signed-off-by Heiner Kallweit <[email protected]>--- drivers/net/phy/mdio_bus.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
Here is the summary with links:
- [net-next] net: mdio: warn once if addr parameter is invalid in mdiobus_get_phy()
https://git.kernel.org/netdev/net-next/c/8a8b70b3f2cf
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html