From: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
To: Jiaxun Yang <jiaxun.yang@flygoat.com>
Cc: linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org,
and@gmx.com, stable@vger.kernel.org
Subject: Re: [PATCH] MIPS: fw: Allow firmware to pass a empty env
Date: Wed, 12 Apr 2023 15:32:34 +0200 [thread overview]
Message-ID: <20230412133234.GF11717@alpha.franken.de> (raw)
In-Reply-To: <20230411111426.55889-1-jiaxun.yang@flygoat.com>
On Tue, Apr 11, 2023 at 12:14:26PM +0100, Jiaxun Yang wrote:
> fw_getenv will use env entry to determine style of env,
> however it is legal for firmware to just pass a empty list.
>
> Check if first entry exist before running strchr to avoid
> null pointer dereference.
>
> Cc: stable@vger.kernel.org
> Link: https://github.com/clbr/n64bootloader/issues/5
> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
> ---
> Note: Fixes tag is intentionally omitted for this patch, although
> the booting issue only comes in 6.1, the logic issue is been since very start.
> ---
> arch/mips/fw/lib/cmdline.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/mips/fw/lib/cmdline.c b/arch/mips/fw/lib/cmdline.c
> index f24cbb4a39b5..892765b742bb 100644
> --- a/arch/mips/fw/lib/cmdline.c
> +++ b/arch/mips/fw/lib/cmdline.c
> @@ -53,7 +53,7 @@ char *fw_getenv(char *envname)
> {
> char *result = NULL;
>
> - if (_fw_envp != NULL) {
> + if (_fw_envp != NULL && fw_envp(0) != NULL) {
> /*
> * Return a pointer to the given environment variable.
> * YAMON uses "name", "value" pairs, while U-Boot uses
> --
> 2.39.2 (Apple Git-143)
applied to mips-next.
Thomas.
--
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea. [ RFC1925, 2.3 ]
prev parent reply other threads:[~2023-04-12 13:34 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-11 11:14 Jiaxun Yang
2023-04-12 13:32 ` Thomas Bogendoerfer [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=20230412133234.GF11717@alpha.franken.de \
--to=tsbogend@alpha.franken.de \
--cc=and@gmx.com \
--cc=jiaxun.yang@flygoat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
--cc=stable@vger.kernel.org \
/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®