lib/dynamic_debug: add NULL check after kstrdup
Subsystems (4)
PATCH 1/4 lib/dynamic_debug: add NULL check after kstrdup
kstrdup(saved_command_line, GFP_KERNEL) may return NULL under memory pressure. Add a check to avoid NULL pointer dereference during boot-time dynamic debug parameter parsing.
--- lib/dynamic_debug.c | 2 ++ 1 file changed, 2 insertions(+)
lib/dynamic_debug.c +2 -0
@@ -1479,6 +1479,8 @@ static int __init dynamic_debug_init(void)* slightly noisy if verbose, but harmless. */ cmdline =kstrdup (saved_command_line,GFP_KERNEL ); +if (!cmdline) +return 0 ;/* prevents a boot-time NULL deref */ parse_args ("dyndbg params" , cmdline,NULL ,0 ,0 ,0 ,NULL , &ddebug_dyndbg_boot_param_cb);kfree (cmdline);
Signature · 1 line
2.54.0
PATCH 2/4 selftests: filesystems: fix spelling mistake in statmount test
--- tools/testing/selftests/filesystems/statmount/statmount_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/filesystems/statmount/statmount_test.c +1 -1
@@ -515,7 +515,7 @@ static void test_statmount_mnt_opts(void)return ; } -ksft_test_result_fail ("didnt't find mount entry\n" ); +ksft_test_result_fail ("didn't find mount entry\n" );free (sm);free (line); }
Signature · 1 line
2.54.0
PATCH 3/4 selftests: powerpc: fix spelling mistake
In reply to Martin Weiss--- tools/testing/selftests/powerpc/tm/tm-tar.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/powerpc/tm/tm-tar.c +1 -1
@@ -50,7 +50,7 @@ int test_tar(void)"bne 2b;" "tend.;" -/* Transaction sucess! TAR should be 3 */ +/* Transaction success! TAR should be 3 */ "mfspr 7, %[tar];" "ori %[res], 7, 4;" // res = 3|4 = 7 "b 4f;"
Signature · 1 line
2.54.0
PATCH 4/4 tools/build: fix spelling mistake in documentation
In reply to Martin Weiss--- tools/build/Documentation/Build.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/build/Documentation/Build.txt +1 -1
@@ -102,7 +102,7 @@ Makefile.include ---------------- The tools/build/Makefile.include makefile could be included -via user makefiles to get usefull definitions. +via user makefiles to get useful definitions. It defines following interface:
Signature · 1 line
2.54.0
Andrew Morton
maintainerQuoted 4 lines · On Mon, 29 Jun 2026 16:30:51 +0700 Martin Weiss <[email protected]>…
kstrdup(saved_command_line, GFP_KERNEL)may return NULL under memory pressure. Add a check to avoid NULL pointer dereference during boot-time dynamic debug parameter parsing.
Thanks.
lib/dynamic_debug.c static int __init dynamic_debug_init(void) · line 1486
Quoted 11 lines
lib/dynamic_debug.c +2
-0@@ -1479,6 +1479,8 @@ static int __init dynamic_debug_init(void)* slightly noisy if verbose, but harmless. */ cmdline =kstrdup (saved_command_line,GFP_KERNEL ); +if (!cmdline) +return 0 ;/* prevents a boot-time NULL deref */ parse_args ("dyndbg params" , cmdline,NULL ,0 ,0 ,0 ,NULL , &ddebug_dyndbg_boot_param_cb);kfree (cmdline);
We conventionally assume that memory allocations at __init time cannot fail. Sashiko explains why ;)
https://sashiko.dev/#/patchset/[email protected]