Skip to contentSkip to conversation

eth: fs_enet: fix print format for resource size

PATCH Applied Jakub Kicinski 3 participants 4 messages Jun 15, 2023 – Jun 16, 2023

Subsystems (3)
lore
Share & tools
lore

Jakub Kicinski

author maintainer
#0 lore raw

PATCH 1/1 eth: fs_enet: fix print format for resource size

Randy forwarded report from Stephen that on PowerPC:

drivers/net/ethernet/freescale/fs_enet/mii-fec.c: In function 'fs_enet_mdio_probe':
drivers/net/ethernet/freescale/fs_enet/mii-fec.c:130:50: warning: format '%x' expects argument of type 'unsigned int', but argument 4 has type 'resource_size_t' {aka 'long long unsigned int'} [-Wformat=]

  130 |         snprintf(new_bus->id, MII_BUS_ID_SIZE, "%x", res.start);
      |                                                 ~^   ~~~~~~~~~
      |                                                  |      |
      |                                                  |      resource_size_t {aka long long unsigned int}
      |                                                  unsigned int
      |                                                 %llx

Use the right print format.

Untested, I can't repro this warning myself. With or without the patch mpc512x_defconfig builds just fine.

---
CC: Randy Dunlap <[email protected]>
CC: [email protected]
CC: [email protected]

Targeting net-next as I can't repro this, and I don't see recent changes which could cause this problem. So maybe it's something in linux-next... ?
In any case res is a struct resource so patch shouldn't hurt.

---
 drivers/net/ethernet/freescale/fs_enet/mii-fec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/freescale/fs_enet/mii-fec.c +1 -1
index d37d7a19a759..59a8f0bd0f5c 100644
@@ -127,7 +127,7 @@ static int fs_enet_mdio_probe(struct platform_device *ofdev)
 	if (ret)
 		goto out_res;
 
-	snprintf(new_bus->id, MII_BUS_ID_SIZE, "%x", res.start);
+	snprintf(new_bus->id, MII_BUS_ID_SIZE, "%pap", &res.start);
 
 	fec->fecp = ioremap(res.start, resource_size(&res));
 	if (!fec->fecp) {
Signature · 1 line
2.40.1
Acked-by Tested-by on v1 1/1
#1 lore raw
Quoted 1 line · Jakub Kicinski

Randy forwarded report from Stephen that on PowerPC:

Stephen forwarded report from Randy?

netdev & pantelis were cc-ed...

Quoted 14 lines

drivers/net/ethernet/freescale/fs_enet/mii-fec.c: In function 'fs_enet_mdio_probe':
drivers/net/ethernet/freescale/fs_enet/mii-fec.c:130:50: warning: format '%x' expects argument of type 'unsigned int', but argument 4 has type 'resource_size_t' {aka 'long long unsigned int'} [-Wformat=]

  130 |         snprintf(new_bus->id, MII_BUS_ID_SIZE, "%x", res.start);
      |                                                 ~^   ~~~~~~~~~
      |                                                  |      |
      |                                                  |      resource_size_t {aka long long unsigned int}
      |                                                  unsigned int
      |                                                 %llx

Use the right print format.

Untested, I can't repro this warning myself. With or without the patch mpc512x_defconfig builds just fine.

Quoted 6 lines

---
CC: Randy Dunlap <[email protected]>
CC: [email protected]
CC: [email protected]

I'm using gcc-12.2.0.

Thanks.

Quoted 22 lines

Targeting net-next as I can't repro this, and I don't see recent changes which could cause this problem. So maybe it's something in linux-next... ?
In any case res is a struct resource so patch shouldn't hurt.

---
 drivers/net/ethernet/freescale/fs_enet/mii-fec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/freescale/fs_enet/mii-fec.c +1 -1
index d37d7a19a759..59a8f0bd0f5c 100644
@@ -127,7 +127,7 @@ static int fs_enet_mdio_probe(struct platform_device *ofdev)
 	if (ret)
 		goto out_res;
 
-	snprintf(new_bus->id, MII_BUS_ID_SIZE, "%x", res.start);
+	snprintf(new_bus->id, MII_BUS_ID_SIZE, "%pap", &res.start);
 
 	fec->fecp = ioremap(res.start, resource_size(&res));
 	if (!fec->fecp) {
Signature · 1 line
~Randy
author maintainer
#2 lore raw
Quoted 6 lines · On Wed, 14 Jun 2023 21:02:33 -0700 Randy Dunlap wrote:
Quoted 1 line · Jakub Kicinski

Randy forwarded report from Stephen that on PowerPC:

Stephen forwarded report from Randy?

netdev & pantelis were cc-ed...

Ah, I misread, you were reporting to Stephen the status for the latest linux-next!

https://lore.kernel.org/all/[email protected]/

Seems obvious in hindsight, sorry. I'll reword when applying.

Quoted 21 lines
Quoted 14 lines

drivers/net/ethernet/freescale/fs_enet/mii-fec.c: In function 'fs_enet_mdio_probe':
drivers/net/ethernet/freescale/fs_enet/mii-fec.c:130:50: warning: format '%x' expects argument of type 'unsigned int', but argument 4 has type 'resource_size_t' {aka 'long long unsigned int'} [-Wformat=]

  130 |         snprintf(new_bus->id, MII_BUS_ID_SIZE, "%x", res.start);
      |                                                 ~^   ~~~~~~~~~
      |                                                  |      |
      |                                                  |      resource_size_t {aka long long unsigned int}
      |                                                  unsigned int
      |                                                 %llx

Use the right print format.

Untested, I can't repro this warning myself. With or without the patch mpc512x_defconfig builds just fine.

Quoted 6 lines

---
CC: Randy Dunlap <[email protected]>
CC: [email protected]
CC: [email protected]

Quoted 5 lines

I'm using gcc-12.2.0.

Thank you! GCC 11.1 here, FWIW.

#3 lore raw
In reply to Jakub Kicinski
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 4 lines · On Wed, 14 Jun 2023 20:52:31 -0700 you wrote:

Randy forwarded report from Stephen that on PowerPC:

drivers/net/ethernet/freescale/fs_enet/mii-fec.c: In function 'fs_enet_mdio_probe':
drivers/net/ethernet/freescale/fs_enet/mii-fec.c:130:50: warning: format '%x' expects argument of type 'unsigned int', but argument 4 has type 'resource_size_t' {aka 'long long unsigned int'} [-Wformat=]

Quoted 8 lines
  130 |         snprintf(new_bus->id, MII_BUS_ID_SIZE, "%x", res.start);
      |                                                 ~^   ~~~~~~~~~
      |                                                  |      |
      |                                                  |      resource_size_t {aka long long unsigned int}
      |                                                  unsigned int
      |                                                 %llx

[...]

Here is the summary with links:
- [net-next] eth: fs_enet: fix print format for resource size

    https://git.kernel.org/netdev/net-next/c/8f72fb1578a9

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html