public inbox for linux-arm-kernel@lists.infradead.org 
 help / color / mirror / Atom feed
* [PATCH] arm: kernel: add NULL pointer check in early_mem()
@ 2026-04-03  6:08 Austin Kim
  2026-04-20  5:04 ` Austin Kim
  0 siblings, 1 reply; 2+ messages in thread
From: Austin Kim @ 2026-04-03  6:08 UTC (permalink / raw)
  To: linux; +Cc: linux-arm-kernel, linux-kernel, austindh.kim

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



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

* Re: [PATCH] arm: kernel: add NULL pointer check in early_mem()
  2026-04-03  6:08 [PATCH] arm: kernel: add NULL pointer check in early_mem() Austin Kim
@ 2026-04-20  5:04 ` Austin Kim
  0 siblings, 0 replies; 2+ messages in thread
From: Austin Kim @ 2026-04-20  5:04 UTC (permalink / raw)
  To: linux; +Cc: linux-arm-kernel, linux-kernel

2026년 4월 3일 (금) 오후 3:08, Austin Kim <austindh.kim@gmail•com>님이 작성:
>
> 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;

Hello, Maintainers

If you are available, would you please leave any comments over this patch?

BR,
Austin Kim

>         /*
>          * If the user specifies memory size, we
>          * blow away any automatically generated
> --
> 2.34.1
>


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

end of thread, other threads:[~2026-04-20  5:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-03  6:08 [PATCH] arm: kernel: add NULL pointer check in early_mem() Austin Kim
2026-04-20  5:04 ` Austin Kim

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