From: Austin Kim <austindh.kim@gmail.com>
To: linux@armlinux.org.uk
Cc: linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, austindh.kim@gmail.com
Subject: [PATCH] arm: kernel: add NULL pointer check in early_mem()
Date: Fri, 3 Apr 2026 15:08:55 +0900 [thread overview]
Message-ID: <ac9Zd3K+PQTGBZAC@adminpc-PowerEdge-R7525> (raw)
The 'early_mem' function handles memory-related boot parameters.
If the parameter 'p' is passed as NULL, it could lead to an
uninitialized or invalid memory access during parsing.
This patch adds a NULL pointer check at the beginning of the
function to return early if no argument is provided, ensuring
system stability during the early boot process.
Signed-off-by: Austin Kim <austindh.kim@gmail.com>
---
arch/arm/kernel/setup.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
index 0bfd66c7a..b718a7df3 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
@@ -830,6 +830,8 @@ static int __init early_mem(char *p)
u64 start;
char *endp;
+ if (!p)
+ return 1;
/*
* If the user specifies memory size, we
* blow away any automatically generated
--
2.34.1
reply other threads:[~2026-04-03 6:09 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=ac9Zd3K+PQTGBZAC@adminpc-PowerEdge-R7525 \
--to=austindh.kim@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
/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