From: Alexandre Ghiti <alex@ghiti.fr>
To: "Christophe JAILLET" <christophe.jaillet@wanadoo.fr>,
"Paul Walmsley" <paul.walmsley@sifive.com>,
"Palmer Dabbelt" <palmer@dabbelt.com>,
"Albert Ou" <aou@eecs.berkeley.edu>,
"Alexandre Ghiti" <alexghiti@rivosinc.com>,
"Björn Töpel" <bjorn@rivosinc.com>
Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org,
Palmer Dabbelt <palmer@rivosinc.com>,
linux-riscv@lists.infradead.org
Subject: Re: [PATCH] riscv: Fix an off-by-one in get_early_cmdline()
Date: Wed, 10 Jan 2024 07:38:48 +0100 [thread overview]
Message-ID: <4e0da12a-62ed-47fa-9f75-a7de10bd8dc0@ghiti.fr> (raw)
In-Reply-To: <9f66d2b58c8052d4055e90b8477ee55d9a0914f9.1698564026.git.christophe.jaillet@wanadoo.fr>
Hi Christophe,
On 29/10/2023 08:20, Christophe JAILLET wrote:
> The ending NULL is not taken into account by strncat(), so switch to
> strlcat() to correctly compute the size of the available memory when
> appending CONFIG_CMDLINE to 'early_cmdline'.
>
> Fixes: 26e7aacb83df ("riscv: Allow to downgrade paging mode from the command line")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> arch/riscv/kernel/pi/cmdline_early.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/arch/riscv/kernel/pi/cmdline_early.c b/arch/riscv/kernel/pi/cmdline_early.c
> index 68e786c84c94..f6d4dedffb84 100644
> --- a/arch/riscv/kernel/pi/cmdline_early.c
> +++ b/arch/riscv/kernel/pi/cmdline_early.c
> @@ -38,8 +38,7 @@ static char *get_early_cmdline(uintptr_t dtb_pa)
> if (IS_ENABLED(CONFIG_CMDLINE_EXTEND) ||
> IS_ENABLED(CONFIG_CMDLINE_FORCE) ||
> fdt_cmdline_size == 0 /* CONFIG_CMDLINE_FALLBACK */) {
> - strncat(early_cmdline, CONFIG_CMDLINE,
> - COMMAND_LINE_SIZE - fdt_cmdline_size);
> + strlcat(early_cmdline, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
> }
>
> return early_cmdline;
This looks good to me, you can add:
Reviewed-by: Alexandre Ghiti <alexghiti@rivosinc.com>
Thanks,
Alex
next prev parent reply other threads:[~2024-01-10 6:39 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-29 7:20 [PATCH] riscv: Fix an off-by-one in get_early_cmdline() Christophe JAILLET
2024-01-10 6:38 ` Alexandre Ghiti [this message]
2024-01-12 6:30 ` patchwork-bot+linux-riscv
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=4e0da12a-62ed-47fa-9f75-a7de10bd8dc0@ghiti.fr \
--to=alex@ghiti.fr \
--cc=alexghiti@rivosinc.com \
--cc=aou@eecs.berkeley.edu \
--cc=bjorn@rivosinc.com \
--cc=christophe.jaillet@wanadoo.fr \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=palmer@dabbelt.com \
--cc=palmer@rivosinc.com \
--cc=paul.walmsley@sifive.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox