All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@kernel.org>
To: Liam Ni <zhiguangni01@gmail.com>
Cc: x86@kernel.org, linux-kernel@vger.kernel.org,
	linux-arch@vger.kernel.org, linux-efi@vger.kernel.org,
	linux-doc@vger.kernel.org, linux-mm@kvack.org,
	kvm@vger.kernel.org, kasan-dev@googlegroups.com
Subject: Re: [PATCH] x86/boot: Check if the input parameter (buffer) of the function is a null pointer
Date: Sat, 7 Jan 2023 11:40:42 +0100	[thread overview]
Message-ID: <Y7lMKhXSQvwvLq7L@gmail.com> (raw)
In-Reply-To: <20221206125929.12237-1-zhiguangni01@gmail.com>


* Liam Ni <zhiguangni01@gmail.com> wrote:

> If the variable buffer is a null pointer, it may cause the kernel to crash.
> 
> Signed-off-by: Liam Ni <zhiguangni01@gmail.com>
> ---
>  arch/x86/boot/cmdline.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/x86/boot/cmdline.c b/arch/x86/boot/cmdline.c
> index 21d56ae83cdf..d0809f66054c 100644
> --- a/arch/x86/boot/cmdline.c
> +++ b/arch/x86/boot/cmdline.c
> @@ -39,7 +39,7 @@ int __cmdline_find_option(unsigned long cmdline_ptr, const char *option, char *b
>  		st_bufcpy	/* Copying this to buffer */
>  	} state = st_wordstart;
>  
> -	if (!cmdline_ptr)
> +	if (!cmdline_ptr || buffer == NULL)
>  		return -1;      /* No command line */

Can this ever happen?

Thanks,

	Ingo

      reply	other threads:[~2023-01-07 10:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-06 12:59 [PATCH] x86/boot: Check if the input parameter (buffer) of the function is a null pointer Liam Ni
2023-01-07 10:40 ` Ingo Molnar [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=Y7lMKhXSQvwvLq7L@gmail.com \
    --to=mingo@kernel.org \
    --cc=kasan-dev@googlegroups.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-efi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=x86@kernel.org \
    --cc=zhiguangni01@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.