Re: [PATCH] net: mdio: octeon: use %p for bus id

From: Russell King (Oracle)

Date: Tue Apr 14 2026 - 13:43:42 EST


On Tue, Apr 14, 2026 at 06:16:08PM +0200, Andrew Lunn wrote:
> On Tue, Apr 14, 2026 at 11:56:52PM +0800, Chen Jung Ku wrote:
> > Replace %px with %p to avoid exposing raw kernel pointer values.
>
> What exactly are we giving away here?
>
> compatible = "cavium,octeon-3860-mdio";
> #address-cells = <1>;
> #size-cells = <0>;
> reg = <0x11800 0x00001900 0x0 0x40>;
>
> Isn't bus->register_base this well known value?
>
> You also need to think about ABI.

There isn't ABI here.

bus->register_base = devm_platform_ioremap_resource(pdev, 0);

snprintf(bus->mii_bus->id, MII_BUS_ID_SIZE, "%px", bus->register_base);

bus->register_base is the ioremap'd version of the resource, which is
effectively random, and it can be either a 32 or 64-bit hex number
depending on the pointer size. It's an exceedingly bad choice of MDIO
bus ID.

A better more stable choice would be to use the bus address or
dev_name().

Even so, I don't think there's any ABI here as the existing "ID" will
not be stable.

--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!