Netdev List
 help / color / mirror / Atom feed
* [PATCH net] net: fec_mpc52xx: Fix resource size format
@ 2026-05-18  4:40 Rosen Penev
  2026-05-19 17:37 ` Joe Perches
  0 siblings, 1 reply; 3+ messages in thread
From: Rosen Penev @ 2026-05-18  4:40 UTC (permalink / raw)
  To: netdev
  Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Joe Perches, open list

resource_size() is printed after casting to unsigned long, but
sizeof() returns size_t.

Use %zx for the sizeof() value so the format string matches the
argument type so that 64-bit builds compile.

Assisted-by: Codex:GPT-5.5
Fixes: 31b7720c8259 ("fec: Convert printks to netdev_<level>")
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
 drivers/net/ethernet/freescale/fec_mpc52xx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/freescale/fec_mpc52xx.c b/drivers/net/ethernet/freescale/fec_mpc52xx.c
index 556f646073af..a770e7edb1dc 100644
--- a/drivers/net/ethernet/freescale/fec_mpc52xx.c
+++ b/drivers/net/ethernet/freescale/fec_mpc52xx.c
@@ -834,7 +834,7 @@ static int mpc52xx_fec_probe(struct platform_device *op)
 		goto err_netdev;
 	}
 	if (resource_size(&mem) < sizeof(struct mpc52xx_fec)) {
-		pr_err("invalid resource size (%lx < %x), check mpc52xx_devices.c\n",
+		pr_err("invalid resource size (%lx < %zx), check mpc52xx_devices.c\n",
 		       (unsigned long)resource_size(&mem),
 		       sizeof(struct mpc52xx_fec));
 		rv = -EINVAL;
-- 
2.54.0


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

* Re: [PATCH net] net: fec_mpc52xx: Fix resource size format
  2026-05-18  4:40 [PATCH net] net: fec_mpc52xx: Fix resource size format Rosen Penev
@ 2026-05-19 17:37 ` Joe Perches
  2026-05-19 21:20   ` Rosen Penev
  0 siblings, 1 reply; 3+ messages in thread
From: Joe Perches @ 2026-05-19 17:37 UTC (permalink / raw)
  To: Rosen Penev, netdev
  Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, open list

On Sun, 2026-05-17 at 21:40 -0700, Rosen Penev wrote:
> resource_size() is printed after casting to unsigned long, but
> sizeof() returns size_t.

trivia and I wonder if this code path is even possible

> diff --git a/drivers/net/ethernet/freescale/fec_mpc52xx.c b/drivers/net/ethernet/freescale/fec_mpc52xx.c
[]
> @@ -834,7 +834,7 @@ static int mpc52xx_fec_probe(struct platform_device *op)
>  		goto err_netdev;
>  	}
>  	if (resource_size(&mem) < sizeof(struct mpc52xx_fec)) {
> -		pr_err("invalid resource size (%lx < %x), check mpc52xx_devices.c\n",
> +		pr_err("invalid resource size (%lx < %zx), check mpc52xx_devices.c\n",
>  		       (unsigned long)resource_size(&mem),
>  		       sizeof(struct mpc52xx_fec));

mpc52xx_devices.c does not exist.
It was deleted nearly 20 years ago by:

commit 917f0af9e5a9ceecf9e72537fabb501254ba321d
Author: Paul Mackerras <paulus@ozlabs.org>
Date:   Mon Jun 9 14:01:46 2008 +1000

and

It's possible to remove the cast to unsigned long and use %pa
and %zx could be %#zx to match output prefixes.

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

* Re: [PATCH net] net: fec_mpc52xx: Fix resource size format
  2026-05-19 17:37 ` Joe Perches
@ 2026-05-19 21:20   ` Rosen Penev
  0 siblings, 0 replies; 3+ messages in thread
From: Rosen Penev @ 2026-05-19 21:20 UTC (permalink / raw)
  To: Joe Perches
  Cc: netdev, Andrew Lunn, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, open list

On Tue, May 19, 2026 at 10:38 AM Joe Perches <joe@perches.com> wrote:
>
> On Sun, 2026-05-17 at 21:40 -0700, Rosen Penev wrote:
> > resource_size() is printed after casting to unsigned long, but
> > sizeof() returns size_t.
>
> trivia and I wonder if this code path is even possible
Not sure what you mean. probe has a corresponding of_match_table in
the platform_driver struct.
>
> > diff --git a/drivers/net/ethernet/freescale/fec_mpc52xx.c b/drivers/net/ethernet/freescale/fec_mpc52xx.c
> []
> > @@ -834,7 +834,7 @@ static int mpc52xx_fec_probe(struct platform_device *op)
> >               goto err_netdev;
> >       }
> >       if (resource_size(&mem) < sizeof(struct mpc52xx_fec)) {
> > -             pr_err("invalid resource size (%lx < %x), check mpc52xx_devices.c\n",
> > +             pr_err("invalid resource size (%lx < %zx), check mpc52xx_devices.c\n",
> >                      (unsigned long)resource_size(&mem),
> >                      sizeof(struct mpc52xx_fec));
>
> mpc52xx_devices.c does not exist.
right. the message is wrong. this is only meant to be a compilation fix.
> It was deleted nearly 20 years ago by:
>
> commit 917f0af9e5a9ceecf9e72537fabb501254ba321d
> Author: Paul Mackerras <paulus@ozlabs.org>
> Date:   Mon Jun 9 14:01:46 2008 +1000
>
> and
>
> It's possible to remove the cast to unsigned long and use %pa
> and %zx could be %#zx to match output prefixes.
Yeah I haven't had luck getting cleanups like this merged. Compilation
fix has a higher chance of getting in.

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

end of thread, other threads:[~2026-05-19 21:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-18  4:40 [PATCH net] net: fec_mpc52xx: Fix resource size format Rosen Penev
2026-05-19 17:37 ` Joe Perches
2026-05-19 21:20   ` Rosen Penev

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