mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Paul Walmsley <pjw@kernel.org>
To: Pengpeng Hou <pengpeng@iscas.ac.cn>
Cc: Paul Walmsley <pjw@kernel.org>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	 Albert Ou <aou@eecs.berkeley.edu>,
	Alexandre Ghiti <alex@ghiti.fr>,
	 linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] riscv: pi: validate early bootargs before string use
Date: Tue, 24 Nov 2026 20:43:21 -0700 (MST)	[thread overview]
Message-ID: <bda6c38f-a3fe-5dd4-3fe3-29f3069a9b42@kernel.org> (raw)
In-Reply-To: <20260403143003.3-riscv-pi-bootargs-pengpeng@iscas.ac.cn>

On Fri, 3 Apr 2026, Pengpeng Hou wrote:

> get_early_cmdline() fetches bootargs directly from the FDT and
> immediately passes the raw property pointer to strlen() before copying
> it into the early command-line buffer. Flat DT properties are external
> boot input, and this path does not prove that bootargs is
> NUL-terminated within its declared bounds.
> 
> Use fdt_stringlist_get() so malformed unterminated bootargs are
> rejected before any C-string helpers walk them.
> 
> Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>

Sashiko points out that this could cause a regression in the 
CONFIG_CMDLINE_FALLBACK-related code, later in get_early_cmdline().  The 
CONFIG_CMDLINE_FALLBACK-related code only tests for fdt_cmdline_size == 0, 
but fdt_stringlist_get() could pass back a negative error code in 
fdt_cmdline_size under some error conditions.  

Care to fix that and resubmit?

thanks,


- Paul

      reply	other threads:[~2026-11-25  3:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-03  3:55 Pengpeng Hou
2026-11-25  3:43 ` Paul Walmsley [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=bda6c38f-a3fe-5dd4-3fe3-29f3069a9b42@kernel.org \
    --to=pjw@kernel.org \
    --cc=alex@ghiti.fr \
    --cc=aou@eecs.berkeley.edu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=palmer@dabbelt.com \
    --cc=pengpeng@iscas.ac.cn \
    /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®