netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: use %ld format specifier for PTR_ERR in pr_warn
@ 2025-04-12 22:55 Qasim Ijaz
  2025-04-12 23:28 ` Kuniyuki Iwashima
  2025-04-13 10:59 ` Jeff Layton
  0 siblings, 2 replies; 5+ messages in thread
From: Qasim Ijaz @ 2025-04-12 22:55 UTC (permalink / raw)
  To: jlayton; +Cc: netdev, linux-kernel

PTR_ERR yields type long, so use %ld format specifier in pr_warn.

Fixes: 193510c95215 ("net: add debugfs files for showing netns refcount tracking info")
Signed-off-by: Qasim Ijaz <qasdev00@gmail.com> 
---
 net/core/net_namespace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c
index f47b9f10af24..a419a3aa57a6 100644
--- a/net/core/net_namespace.c
+++ b/net/core/net_namespace.c
@@ -1652,7 +1652,7 @@ static int __init ns_debug_init(void)
 	if (ref_tracker_debug_dir) {
 		ns_ref_tracker_dir = debugfs_create_dir("net_ns", ref_tracker_debug_dir);
 		if (IS_ERR(ns_ref_tracker_dir)) {
-			pr_warn("net: unable to create ref_tracker/net_ns directory: %d\n",
+			pr_warn("net: unable to create ref_tracker/net_ns directory: %ld\n",
 				PTR_ERR(ns_ref_tracker_dir));
 			goto out;
 		}
-- 
2.39.5


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

* Re: [PATCH] net: use %ld format specifier for PTR_ERR in pr_warn
  2025-04-12 22:55 [PATCH] net: use %ld format specifier for PTR_ERR in pr_warn Qasim Ijaz
@ 2025-04-12 23:28 ` Kuniyuki Iwashima
  2025-04-13  2:07   ` Nathan Chancellor
  2025-04-13 10:56   ` Qasim Ijaz
  2025-04-13 10:59 ` Jeff Layton
  1 sibling, 2 replies; 5+ messages in thread
From: Kuniyuki Iwashima @ 2025-04-12 23:28 UTC (permalink / raw)
  To: qasdev00; +Cc: jlayton, linux-kernel, netdev

From: Qasim Ijaz <qasdev00@gmail.com>
Date: Sat, 12 Apr 2025 23:55:28 +0100
> PTR_ERR yields type long, so use %ld format specifier in pr_warn.

errno fits in the range of int, so no need to use %ld.


> 
> Fixes: 193510c95215 ("net: add debugfs files for showing netns refcount tracking info")

The series is not yet applied.  It's not necessary this time, but
in such a case, please reply to the original patch thread.

Also, please make sure your patch can be applied cleanly on the latest
remote net-next.git and the Fixes tag points to an existing commit.


> Signed-off-by: Qasim Ijaz <qasdev00@gmail.com> 
> ---
>  net/core/net_namespace.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c
> index f47b9f10af24..a419a3aa57a6 100644
> --- a/net/core/net_namespace.c
> +++ b/net/core/net_namespace.c
> @@ -1652,7 +1652,7 @@ static int __init ns_debug_init(void)
>  	if (ref_tracker_debug_dir) {
>  		ns_ref_tracker_dir = debugfs_create_dir("net_ns", ref_tracker_debug_dir);
>  		if (IS_ERR(ns_ref_tracker_dir)) {
> -			pr_warn("net: unable to create ref_tracker/net_ns directory: %d\n",
> +			pr_warn("net: unable to create ref_tracker/net_ns directory: %ld\n",
>  				PTR_ERR(ns_ref_tracker_dir));
>  			goto out;
>  		}
> -- 
> 2.39.5

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

* Re: [PATCH] net: use %ld format specifier for PTR_ERR in pr_warn
  2025-04-12 23:28 ` Kuniyuki Iwashima
@ 2025-04-13  2:07   ` Nathan Chancellor
  2025-04-13 10:56   ` Qasim Ijaz
  1 sibling, 0 replies; 5+ messages in thread
From: Nathan Chancellor @ 2025-04-13  2:07 UTC (permalink / raw)
  To: Kuniyuki Iwashima; +Cc: qasdev00, jlayton, linux-kernel, netdev

On Sat, Apr 12, 2025 at 04:28:38PM -0700, Kuniyuki Iwashima wrote:
> From: Qasim Ijaz <qasdev00@gmail.com>
> Date: Sat, 12 Apr 2025 23:55:28 +0100
> > PTR_ERR yields type long, so use %ld format specifier in pr_warn.
> 
> errno fits in the range of int, so no need to use %ld.

Sure but the compiler does not know that and will warn about the
format specifier and type mismatch:

https://lore.kernel.org/202504130642.HaAQv94V-lkp@intel.com/

I think my comment about switching to '%pe' on basically the same patch
in lib/ref_tracker.c is relevant here too:

https://lore.kernel.org/20250413013245.GA2989337@ax162/

Cheers,
Nathan

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

* Re: [PATCH] net: use %ld format specifier for PTR_ERR in pr_warn
  2025-04-12 23:28 ` Kuniyuki Iwashima
  2025-04-13  2:07   ` Nathan Chancellor
@ 2025-04-13 10:56   ` Qasim Ijaz
  1 sibling, 0 replies; 5+ messages in thread
From: Qasim Ijaz @ 2025-04-13 10:56 UTC (permalink / raw)
  To: Kuniyuki Iwashima; +Cc: jlayton, linux-kernel, netdev, nathan

On Sat, Apr 12, 2025 at 04:28:38PM -0700, Kuniyuki Iwashima wrote:
> From: Qasim Ijaz <qasdev00@gmail.com>
> Date: Sat, 12 Apr 2025 23:55:28 +0100
> > PTR_ERR yields type long, so use %ld format specifier in pr_warn.
> 
> errno fits in the range of int, so no need to use %ld.
> 
> 
> > 
> > Fixes: 193510c95215 ("net: add debugfs files for showing netns refcount tracking info")
> 
> The series is not yet applied.  It's not necessary this time, but
> in such a case, please reply to the original patch thread.
> 
> Also, please make sure your patch can be applied cleanly on the latest
> remote net-next.git and the Fixes tag points to an existing commit.
> 
Hi Kuniyuki

Thank you for your comments, as Nathan said the current code emits a
compiler warning as per the kernel test robot. 

Given this would you like me to resend patch v2 with the changes you and
Nathan specified?

Regards,
Qasim
> 
> > Signed-off-by: Qasim Ijaz <qasdev00@gmail.com> 
> > ---
> >  net/core/net_namespace.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c
> > index f47b9f10af24..a419a3aa57a6 100644
> > --- a/net/core/net_namespace.c
> > +++ b/net/core/net_namespace.c
> > @@ -1652,7 +1652,7 @@ static int __init ns_debug_init(void)
> >  	if (ref_tracker_debug_dir) {
> >  		ns_ref_tracker_dir = debugfs_create_dir("net_ns", ref_tracker_debug_dir);
> >  		if (IS_ERR(ns_ref_tracker_dir)) {
> > -			pr_warn("net: unable to create ref_tracker/net_ns directory: %d\n",
> > +			pr_warn("net: unable to create ref_tracker/net_ns directory: %ld\n",
> >  				PTR_ERR(ns_ref_tracker_dir));
> >  			goto out;
> >  		}
> > -- 
> > 2.39.5

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

* Re: [PATCH] net: use %ld format specifier for PTR_ERR in pr_warn
  2025-04-12 22:55 [PATCH] net: use %ld format specifier for PTR_ERR in pr_warn Qasim Ijaz
  2025-04-12 23:28 ` Kuniyuki Iwashima
@ 2025-04-13 10:59 ` Jeff Layton
  1 sibling, 0 replies; 5+ messages in thread
From: Jeff Layton @ 2025-04-13 10:59 UTC (permalink / raw)
  To: Qasim Ijaz; +Cc: netdev, linux-kernel

On Sat, 2025-04-12 at 23:55 +0100, Qasim Ijaz wrote:
> PTR_ERR yields type long, so use %ld format specifier in pr_warn.
> 
> Fixes: 193510c95215 ("net: add debugfs files for showing netns refcount tracking info")
> Signed-off-by: Qasim Ijaz <qasdev00@gmail.com> 
> ---
>  net/core/net_namespace.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c
> index f47b9f10af24..a419a3aa57a6 100644
> --- a/net/core/net_namespace.c
> +++ b/net/core/net_namespace.c
> @@ -1652,7 +1652,7 @@ static int __init ns_debug_init(void)
>  	if (ref_tracker_debug_dir) {
>  		ns_ref_tracker_dir = debugfs_create_dir("net_ns", ref_tracker_debug_dir);
>  		if (IS_ERR(ns_ref_tracker_dir)) {
> -			pr_warn("net: unable to create ref_tracker/net_ns directory: %d\n",
> +			pr_warn("net: unable to create ref_tracker/net_ns directory: %ld\n",
>  				PTR_ERR(ns_ref_tracker_dir));
>  			goto out;
>  		}

Thanks, that will silence a potential compiler warning. This is not
merged yet, but I'll make sure to incorporate this change in the next
version.

FWIW, I'm planning to put together a v3 that will require less
involvement with net/ code, so most of these bits will probably get
deleted anyway.

Cheers!
-- 
Jeff Layton <jlayton@kernel.org>

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

end of thread, other threads:[~2025-04-13 10:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-12 22:55 [PATCH] net: use %ld format specifier for PTR_ERR in pr_warn Qasim Ijaz
2025-04-12 23:28 ` Kuniyuki Iwashima
2025-04-13  2:07   ` Nathan Chancellor
2025-04-13 10:56   ` Qasim Ijaz
2025-04-13 10:59 ` Jeff Layton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).