mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Greg Ungerer <gerg@linux-m68k.org>
To: Thorsten Blum <thorsten.blum@linux.dev>,
	Geert Uytterhoeven <geert@linux-m68k.org>
Cc: linux-m68k@lists.linux-m68k.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] m68k: Replace memcpy() + manual NUL-termination with strscpy()
Date: Mon, 28 Apr 2025 09:52:43 +1000	[thread overview]
Message-ID: <8e6f3ad3-393b-4777-a4d0-24a524aad5aa@linux-m68k.org> (raw)
In-Reply-To: <20250415072433.75505-1-thorsten.blum@linux.dev>

Hi Thorsten,

On 15/4/25 17:24, Thorsten Blum wrote:
> Use strscpy() to safely copy the command-line string instead of memcpy()
> followed by a manual NUL-termination.
> 
> The source string is also NUL-terminated and meets the __must_be_cstr()
> requirement of strscpy().
> 
> No functional changes intended.
> 
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>

Thanks, applied to m68knommu git tree, for-next branch.

Regards
Greg


> ---
>   arch/m68k/kernel/setup_no.c | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/arch/m68k/kernel/setup_no.c b/arch/m68k/kernel/setup_no.c
> index f9872098f5ca..f724875b15cc 100644
> --- a/arch/m68k/kernel/setup_no.c
> +++ b/arch/m68k/kernel/setup_no.c
> @@ -145,8 +145,7 @@ void __init setup_arch(char **cmdline_p)
>   
>   	/* Keep a copy of command line */
>   	*cmdline_p = &command_line[0];
> -	memcpy(boot_command_line, command_line, COMMAND_LINE_SIZE);
> -	boot_command_line[COMMAND_LINE_SIZE-1] = 0;
> +	strscpy(boot_command_line, command_line, COMMAND_LINE_SIZE);
>   
>   	/*
>   	 * Give all the memory to the bootmap allocator, tell it to put the


      reply	other threads:[~2025-04-27 23:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-15  7:24 Thorsten Blum
2025-04-27 23:52 ` Greg Ungerer [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=8e6f3ad3-393b-4777-a4d0-24a524aad5aa@linux-m68k.org \
    --to=gerg@linux-m68k.org \
    --cc=geert@linux-m68k.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-m68k@lists.linux-m68k.org \
    --cc=thorsten.blum@linux.dev \
    /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®