mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
To: Thorsten Blum <thorsten.blum@linux.dev>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Christian Brauner <brauner@kernel.org>,
	"Liam R. Howlett" <Liam.Howlett@oracle.com>,
	Suren Baghdasaryan <surenb@google.com>,
	Wei Yang <richard.weiyang@gmail.com>,
	David Hildenbrand <david@redhat.com>,
	Miaohe Lin <linmiaohe@huawei.com>,
	Al Viro <viro@zeniv.linux.org.uk>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] fork: Remove unnecessary size argument when calling strscpy()
Date: Tue, 11 Mar 2025 11:13:13 +0000	[thread overview]
Message-ID: <05250cea-4738-4bfa-a669-a81a64d3e82e@lucifer.local> (raw)
In-Reply-To: <20250311110542.495630-1-thorsten.blum@linux.dev>

On Tue, Mar 11, 2025 at 12:05:39PM +0100, Thorsten Blum wrote:
> The size parameter is optional and strscpy() automatically determines
> the length of the destination buffer using sizeof() if the argument is
> omitted. This makes the explicit sizeof() unnecessary. Remove it to
> simplify the code.
>
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>

Hm not sure about this one, it's not really simplifying anything all too
much and seems like somewhat useless churn?

It's pretty clear what's going on here already.

> ---
>  kernel/fork.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/fork.c b/kernel/fork.c
> index 735405a9c5f3..81eef131e23c 100644
> --- a/kernel/fork.c
> +++ b/kernel/fork.c
> @@ -2248,7 +2248,7 @@ __latent_entropy struct task_struct *copy_process(
>  		p->flags |= PF_IO_WORKER;
>
>  	if (args->name)
> -		strscpy_pad(p->comm, args->name, sizeof(p->comm));
> +		strscpy_pad(p->comm, args->name);
>
>  	p->set_child_tid = (clone_flags & CLONE_CHILD_SETTID) ? args->child_tid : NULL;
>  	/*
> --
> 2.48.1
>

  reply	other threads:[~2025-03-11 11:13 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-11 11:05 Thorsten Blum
2025-03-11 11:13 ` Lorenzo Stoakes [this message]
2025-03-18 22:50   ` Thorsten Blum

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=05250cea-4738-4bfa-a669-a81a64d3e82e@lucifer.local \
    --to=lorenzo.stoakes@oracle.com \
    --cc=Liam.Howlett@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=brauner@kernel.org \
    --cc=david@redhat.com \
    --cc=linmiaohe@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=richard.weiyang@gmail.com \
    --cc=surenb@google.com \
    --cc=thorsten.blum@linux.dev \
    --cc=viro@zeniv.linux.org.uk \
    /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®