mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] objtool: Fix NULL printf() '%s' argument
@ 2025-03-26  1:30 Josh Poimboeuf
  2025-03-26  4:10 ` Stephen Rothwell
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Josh Poimboeuf @ 2025-03-26  1:30 UTC (permalink / raw)
  To: x86
  Cc: linux-kernel, Ingo Molnar, Peter Zijlstra, H. Peter Anvin,
	Stephen Rothwell

It's probably not the best idea to pass a string pointer to printf()
right after confirming said pointer is NULL.  Fix the typo and use
argv[i] instead.

Fixes: c5995abe1547 ("objtool: Improve error handling")
Closes: https://lore.kernel.org/20250326103854.309e3c60@canb.auug.org.au
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
---
 tools/objtool/builtin-check.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/objtool/builtin-check.c b/tools/objtool/builtin-check.c
index 2bdff910430e..e364ab6345d3 100644
--- a/tools/objtool/builtin-check.c
+++ b/tools/objtool/builtin-check.c
@@ -238,7 +238,7 @@ static void save_argv(int argc, const char **argv)
 	for (int i = 0; i < argc; i++) {
 		orig_argv[i] = strdup(argv[i]);
 		if (!orig_argv[i]) {
-			WARN_GLIBC("strdup(%s)", orig_argv[i]);
+			WARN_GLIBC("strdup(%s)", argv[i]);
 			exit(1);
 		}
 	};
-- 
2.48.1


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

* Re: [PATCH] objtool: Fix NULL printf() '%s' argument
  2025-03-26  1:30 [PATCH] objtool: Fix NULL printf() '%s' argument Josh Poimboeuf
@ 2025-03-26  4:10 ` Stephen Rothwell
  2025-03-26  7:26   ` Ingo Molnar
  2025-03-26  7:31 ` [tip: objtool/urgent] objtool: Fix NULL printf() '%s' argument in builtin-check.c:save_argv() tip-bot2 for Josh Poimboeuf
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 7+ messages in thread
From: Stephen Rothwell @ 2025-03-26  4:10 UTC (permalink / raw)
  To: Josh Poimboeuf
  Cc: x86, linux-kernel, Ingo Molnar, Peter Zijlstra, H. Peter Anvin

[-- Attachment #1: Type: text/plain, Size: 1422 bytes --]

Hi Josh,

On Tue, 25 Mar 2025 18:30:37 -0700 Josh Poimboeuf <jpoimboe@kernel.org> wrote:
>
> It's probably not the best idea to pass a string pointer to printf()
> right after confirming said pointer is NULL.  Fix the typo and use
> argv[i] instead.
> 
> Fixes: c5995abe1547 ("objtool: Improve error handling")
> Closes: https://lore.kernel.org/20250326103854.309e3c60@canb.auug.org.au
> Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
> Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
> ---
>  tools/objtool/builtin-check.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/objtool/builtin-check.c b/tools/objtool/builtin-check.c
> index 2bdff910430e..e364ab6345d3 100644
> --- a/tools/objtool/builtin-check.c
> +++ b/tools/objtool/builtin-check.c
> @@ -238,7 +238,7 @@ static void save_argv(int argc, const char **argv)
>  	for (int i = 0; i < argc; i++) {
>  		orig_argv[i] = strdup(argv[i]);
>  		if (!orig_argv[i]) {
> -			WARN_GLIBC("strdup(%s)", orig_argv[i]);
> +			WARN_GLIBC("strdup(%s)", argv[i]);
>  			exit(1);
>  		}
>  	};
> -- 
> 2.48.1
> 

Thanks.  I have applied this to the merge of the tip tree (which
include the tip-fixes tree) in linux-next today.  It fixes the build
failure for me.  I will apply it to the merge of the tip-fixes tree
tomorrow unless it has already been applied by then.

-- 
Cheers,
Stephen Rothwell

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH] objtool: Fix NULL printf() '%s' argument
  2025-03-26  4:10 ` Stephen Rothwell
@ 2025-03-26  7:26   ` Ingo Molnar
  2025-03-26 13:13     ` Stephen Rothwell
  0 siblings, 1 reply; 7+ messages in thread
From: Ingo Molnar @ 2025-03-26  7:26 UTC (permalink / raw)
  To: Stephen Rothwell
  Cc: Josh Poimboeuf, x86, linux-kernel, Peter Zijlstra, H. Peter Anvin


* Stephen Rothwell <sfr@canb.auug.org.au> wrote:

> Hi Josh,
> 
> On Tue, 25 Mar 2025 18:30:37 -0700 Josh Poimboeuf <jpoimboe@kernel.org> wrote:
> >
> > It's probably not the best idea to pass a string pointer to printf()
> > right after confirming said pointer is NULL.  Fix the typo and use
> > argv[i] instead.
> > 
> > Fixes: c5995abe1547 ("objtool: Improve error handling")
> > Closes: https://lore.kernel.org/20250326103854.309e3c60@canb.auug.org.au
> > Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
> > Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
> > ---
> >  tools/objtool/builtin-check.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/tools/objtool/builtin-check.c b/tools/objtool/builtin-check.c
> > index 2bdff910430e..e364ab6345d3 100644
> > --- a/tools/objtool/builtin-check.c
> > +++ b/tools/objtool/builtin-check.c
> > @@ -238,7 +238,7 @@ static void save_argv(int argc, const char **argv)
> >  	for (int i = 0; i < argc; i++) {
> >  		orig_argv[i] = strdup(argv[i]);
> >  		if (!orig_argv[i]) {
> > -			WARN_GLIBC("strdup(%s)", orig_argv[i]);
> > +			WARN_GLIBC("strdup(%s)", argv[i]);
> >  			exit(1);
> >  		}
> >  	};
> > -- 
> > 2.48.1
> > 
> 
> Thanks.  I have applied this to the merge of the tip tree (which
> include the tip-fixes tree) in linux-next today.  It fixes the build
> failure for me.  I will apply it to the merge of the tip-fixes tree
> tomorrow unless it has already been applied by then.

Thanks, I've re-spun tip/urgent, so the next -next iteration ought to 
pick up the fix.

	Ingo

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

* [tip: objtool/urgent] objtool: Fix NULL printf() '%s' argument in builtin-check.c:save_argv()
  2025-03-26  1:30 [PATCH] objtool: Fix NULL printf() '%s' argument Josh Poimboeuf
  2025-03-26  4:10 ` Stephen Rothwell
@ 2025-03-26  7:31 ` tip-bot2 for Josh Poimboeuf
  2025-03-27 11:06 ` tip-bot2 for Josh Poimboeuf
  2025-03-28 13:48 ` tip-bot2 for Josh Poimboeuf
  3 siblings, 0 replies; 7+ messages in thread
From: tip-bot2 for Josh Poimboeuf @ 2025-03-26  7:31 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Stephen Rothwell, Josh Poimboeuf, Ingo Molnar, x86, linux-kernel

The following commit has been merged into the objtool/urgent branch of tip:

Commit-ID:     89721c2ca8aec6f45166acf61ae32f64f2f1d2db
Gitweb:        https://git.kernel.org/tip/89721c2ca8aec6f45166acf61ae32f64f2f1d2db
Author:        Josh Poimboeuf <jpoimboe@kernel.org>
AuthorDate:    Tue, 25 Mar 2025 18:30:37 -07:00
Committer:     Ingo Molnar <mingo@kernel.org>
CommitterDate: Wed, 26 Mar 2025 08:24:59 +01:00

objtool: Fix NULL printf() '%s' argument in builtin-check.c:save_argv()

It's probably not the best idea to pass a string pointer to printf()
right after confirming said pointer is NULL.  Fix the typo and use
argv[i] instead.

Fixes: c5995abe1547 ("objtool: Improve error handling")
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Tested-by: Stephen Rothwell <sfr@canb.auug.org.au>
Link: https://lore.kernel.org/r/a814ed8b08fb410be29498a20a5fbbb26e907ecf.1742952512.git.jpoimboe@kernel.org
Closes: https://lore.kernel.org/20250326103854.309e3c60@canb.auug.org.au
---
 tools/objtool/builtin-check.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/objtool/builtin-check.c b/tools/objtool/builtin-check.c
index 2bdff91..e364ab6 100644
--- a/tools/objtool/builtin-check.c
+++ b/tools/objtool/builtin-check.c
@@ -238,7 +238,7 @@ static void save_argv(int argc, const char **argv)
 	for (int i = 0; i < argc; i++) {
 		orig_argv[i] = strdup(argv[i]);
 		if (!orig_argv[i]) {
-			WARN_GLIBC("strdup(%s)", orig_argv[i]);
+			WARN_GLIBC("strdup(%s)", argv[i]);
 			exit(1);
 		}
 	};

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

* Re: [PATCH] objtool: Fix NULL printf() '%s' argument
  2025-03-26  7:26   ` Ingo Molnar
@ 2025-03-26 13:13     ` Stephen Rothwell
  0 siblings, 0 replies; 7+ messages in thread
From: Stephen Rothwell @ 2025-03-26 13:13 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Josh Poimboeuf, x86, linux-kernel, Peter Zijlstra, H. Peter Anvin

[-- Attachment #1: Type: text/plain, Size: 231 bytes --]

Hi Ingo,

On Wed, 26 Mar 2025 08:26:00 +0100 Ingo Molnar <mingo@kernel.org> wrote:
>
> Thanks, I've re-spun tip/urgent, so the next -next iteration ought to 
> pick up the fix.

Excellent.

-- 
Cheers,
Stephen Rothwell

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* [tip: objtool/urgent] objtool: Fix NULL printf() '%s' argument in builtin-check.c:save_argv()
  2025-03-26  1:30 [PATCH] objtool: Fix NULL printf() '%s' argument Josh Poimboeuf
  2025-03-26  4:10 ` Stephen Rothwell
  2025-03-26  7:31 ` [tip: objtool/urgent] objtool: Fix NULL printf() '%s' argument in builtin-check.c:save_argv() tip-bot2 for Josh Poimboeuf
@ 2025-03-27 11:06 ` tip-bot2 for Josh Poimboeuf
  2025-03-28 13:48 ` tip-bot2 for Josh Poimboeuf
  3 siblings, 0 replies; 7+ messages in thread
From: tip-bot2 for Josh Poimboeuf @ 2025-03-27 11:06 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Stephen Rothwell, Josh Poimboeuf, Ingo Molnar, x86, linux-kernel

The following commit has been merged into the objtool/urgent branch of tip:

Commit-ID:     1c9d28fdf70d4ae3e8dfeadee982461403c6bb50
Gitweb:        https://git.kernel.org/tip/1c9d28fdf70d4ae3e8dfeadee982461403c6bb50
Author:        Josh Poimboeuf <jpoimboe@kernel.org>
AuthorDate:    Tue, 25 Mar 2025 18:30:37 -07:00
Committer:     Ingo Molnar <mingo@kernel.org>
CommitterDate: Thu, 27 Mar 2025 11:59:11 +01:00

objtool: Fix NULL printf() '%s' argument in builtin-check.c:save_argv()

It's probably not the best idea to pass a string pointer to printf()
right after confirming said pointer is NULL.  Fix the typo and use
argv[i] instead.

Fixes: c5995abe1547 ("objtool: Improve error handling")
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Tested-by: Stephen Rothwell <sfr@canb.auug.org.au>
Link: https://lore.kernel.org/r/a814ed8b08fb410be29498a20a5fbbb26e907ecf.1742952512.git.jpoimboe@kernel.org
Closes: https://lore.kernel.org/20250326103854.309e3c60@canb.auug.org.au
---
 tools/objtool/builtin-check.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/objtool/builtin-check.c b/tools/objtool/builtin-check.c
index 2bdff91..e364ab6 100644
--- a/tools/objtool/builtin-check.c
+++ b/tools/objtool/builtin-check.c
@@ -238,7 +238,7 @@ static void save_argv(int argc, const char **argv)
 	for (int i = 0; i < argc; i++) {
 		orig_argv[i] = strdup(argv[i]);
 		if (!orig_argv[i]) {
-			WARN_GLIBC("strdup(%s)", orig_argv[i]);
+			WARN_GLIBC("strdup(%s)", argv[i]);
 			exit(1);
 		}
 	};

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

* [tip: objtool/urgent] objtool: Fix NULL printf() '%s' argument in builtin-check.c:save_argv()
  2025-03-26  1:30 [PATCH] objtool: Fix NULL printf() '%s' argument Josh Poimboeuf
                   ` (2 preceding siblings ...)
  2025-03-27 11:06 ` tip-bot2 for Josh Poimboeuf
@ 2025-03-28 13:48 ` tip-bot2 for Josh Poimboeuf
  3 siblings, 0 replies; 7+ messages in thread
From: tip-bot2 for Josh Poimboeuf @ 2025-03-28 13:48 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Stephen Rothwell, Josh Poimboeuf, Ingo Molnar, x86, linux-kernel

The following commit has been merged into the objtool/urgent branch of tip:

Commit-ID:     d9a595c3850ea4383628115df2bb533af3b29f4f
Gitweb:        https://git.kernel.org/tip/d9a595c3850ea4383628115df2bb533af3b29f4f
Author:        Josh Poimboeuf <jpoimboe@kernel.org>
AuthorDate:    Tue, 25 Mar 2025 18:30:37 -07:00
Committer:     Ingo Molnar <mingo@kernel.org>
CommitterDate: Fri, 28 Mar 2025 14:38:09 +01:00

objtool: Fix NULL printf() '%s' argument in builtin-check.c:save_argv()

It's probably not the best idea to pass a string pointer to printf()
right after confirming said pointer is NULL.  Fix the typo and use
argv[i] instead.

Fixes: c5995abe1547 ("objtool: Improve error handling")
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Tested-by: Stephen Rothwell <sfr@canb.auug.org.au>
Link: https://lore.kernel.org/r/a814ed8b08fb410be29498a20a5fbbb26e907ecf.1742952512.git.jpoimboe@kernel.org
Closes: https://lore.kernel.org/20250326103854.309e3c60@canb.auug.org.au
---
 tools/objtool/builtin-check.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/objtool/builtin-check.c b/tools/objtool/builtin-check.c
index 2bdff91..e364ab6 100644
--- a/tools/objtool/builtin-check.c
+++ b/tools/objtool/builtin-check.c
@@ -238,7 +238,7 @@ static void save_argv(int argc, const char **argv)
 	for (int i = 0; i < argc; i++) {
 		orig_argv[i] = strdup(argv[i]);
 		if (!orig_argv[i]) {
-			WARN_GLIBC("strdup(%s)", orig_argv[i]);
+			WARN_GLIBC("strdup(%s)", argv[i]);
 			exit(1);
 		}
 	};

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

end of thread, other threads:[~2025-03-28 13:48 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-03-26  1:30 [PATCH] objtool: Fix NULL printf() '%s' argument Josh Poimboeuf
2025-03-26  4:10 ` Stephen Rothwell
2025-03-26  7:26   ` Ingo Molnar
2025-03-26 13:13     ` Stephen Rothwell
2025-03-26  7:31 ` [tip: objtool/urgent] objtool: Fix NULL printf() '%s' argument in builtin-check.c:save_argv() tip-bot2 for Josh Poimboeuf
2025-03-27 11:06 ` tip-bot2 for Josh Poimboeuf
2025-03-28 13:48 ` tip-bot2 for Josh Poimboeuf

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

all inboxes | Powered by JetHome®