From: Andrew Morton <akpm@linux-foundation.org>
To: Martin Weiss <martin.githubacc@gmail.com>
Cc: linux-kernel@vger.kernel.org,
Martin Weiss <Martin.weiss2410@gmail.com>,
Jason Baron <jbaron@akamai.com>,
Jim Cromie <jim.cromie@gmail.com>
Subject: Re: [PATCH 1/4] lib/dynamic_debug: add NULL check after kstrdup
Date: Mon, 29 Jun 2026 16:51:46 -0700 [thread overview]
Message-ID: <20260629165146.f8cce11cdd13682d482c0319@linux-foundation.org> (raw)
In-Reply-To: <20260629093056.591498-1-Martin.weiss2410@gmail.com>
On Mon, 29 Jun 2026 16:30:51 +0700 Martin Weiss <martin.githubacc@gmail.com> wrote:
> 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.
> --- a/lib/dynamic_debug.c
> +++ b/lib/dynamic_debug.c
> @@ -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/20260629093056.591498-1-Martin.weiss2410@gmail.com
prev parent reply other threads:[~2026-06-29 23:51 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-29 9:30 Martin Weiss
2026-06-29 9:30 ` [PATCH 2/4] selftests: filesystems: fix spelling mistake in statmount test Martin Weiss
2026-06-29 9:30 ` [PATCH 3/4] selftests: powerpc: fix spelling mistake Martin Weiss
2026-06-29 9:30 ` [PATCH 4/4] tools/build: fix spelling mistake in documentation Martin Weiss
2026-06-29 23:51 ` Andrew Morton [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260629165146.f8cce11cdd13682d482c0319@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=Martin.weiss2410@gmail.com \
--cc=jbaron@akamai.com \
--cc=jim.cromie@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=martin.githubacc@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®