public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net: mdio: octeon: use %p for bus id
@ 2026-04-14 15:56 Chen Jung Ku
  2026-04-14 16:16 ` Andrew Lunn
  0 siblings, 1 reply; 4+ messages in thread
From: Chen Jung Ku @ 2026-04-14 15:56 UTC (permalink / raw)
  To: davem, kuba
  Cc: edumazet, pabeni, andrew, hkallweit1, linux, netdev, linux-kernel,
	Chen Jung Ku

Replace %px with %p to avoid exposing raw kernel pointer values.

Signed-off-by: Chen Jung Ku <ku.loong@gapp.nthu.edu.tw>
---
 drivers/net/mdio/mdio-octeon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/mdio/mdio-octeon.c b/drivers/net/mdio/mdio-octeon.c
index cb53dccbde1a..c9c000bb0cd5 100644
--- a/drivers/net/mdio/mdio-octeon.c
+++ b/drivers/net/mdio/mdio-octeon.c
@@ -38,7 +38,7 @@ static int octeon_mdiobus_probe(struct platform_device *pdev)
 	oct_mdio_writeq(smi_en.u64, bus->register_base + SMI_EN);
 
 	bus->mii_bus->name = KBUILD_MODNAME;
-	snprintf(bus->mii_bus->id, MII_BUS_ID_SIZE, "%px", bus->register_base);
+	snprintf(bus->mii_bus->id, MII_BUS_ID_SIZE, "%p", bus->register_base);
 	bus->mii_bus->parent = &pdev->dev;
 
 	bus->mii_bus->read = cavium_mdiobus_read_c22;
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] net: mdio: octeon: use %p for bus id
  2026-04-14 15:56 [PATCH] net: mdio: octeon: use %p for bus id Chen Jung Ku
@ 2026-04-14 16:16 ` Andrew Lunn
  2026-04-14 17:10   ` 古鎮榮
  2026-04-14 17:42   ` Russell King (Oracle)
  0 siblings, 2 replies; 4+ messages in thread
From: Andrew Lunn @ 2026-04-14 16:16 UTC (permalink / raw)
  To: Chen Jung Ku
  Cc: davem, kuba, edumazet, pabeni, hkallweit1, linux, netdev,
	linux-kernel

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.

    Andrew

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] net: mdio: octeon: use %p for bus id
  2026-04-14 16:16 ` Andrew Lunn
@ 2026-04-14 17:10   ` 古鎮榮
  2026-04-14 17:42   ` Russell King (Oracle)
  1 sibling, 0 replies; 4+ messages in thread
From: 古鎮榮 @ 2026-04-14 17:10 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: davem, kuba, edumazet, pabeni, hkallweit1, linux, netdev,
	linux-kernel

Thank you for the clarification. I understand the concern now and will
not pursue this patch further.

Best regards,
Chen Jung Ku

Andrew Lunn <andrew@lunn.ch> 於 2026年4月15日週三 上午12:16寫道:
>
> 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.
>
>     Andrew

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] net: mdio: octeon: use %p for bus id
  2026-04-14 16:16 ` Andrew Lunn
  2026-04-14 17:10   ` 古鎮榮
@ 2026-04-14 17:42   ` Russell King (Oracle)
  1 sibling, 0 replies; 4+ messages in thread
From: Russell King (Oracle) @ 2026-04-14 17:42 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: Chen Jung Ku, davem, kuba, edumazet, pabeni, hkallweit1, netdev,
	linux-kernel

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!

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-04-14 17:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-14 15:56 [PATCH] net: mdio: octeon: use %p for bus id Chen Jung Ku
2026-04-14 16:16 ` Andrew Lunn
2026-04-14 17:10   ` 古鎮榮
2026-04-14 17:42   ` Russell King (Oracle)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox