[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <05250cea-4738-4bfa-a669-a81a64d3e82e@lucifer.local>
Date: Tue, 11 Mar 2025 11:13:13 +0000
From: Lorenzo Stoakes <lorenzo.stoakes@...cle.com>
To: Thorsten Blum <thorsten.blum@...ux.dev>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Christian Brauner <brauner@...nel.org>,
"Liam R. Howlett" <Liam.Howlett@...cle.com>,
Suren Baghdasaryan <surenb@...gle.com>,
Wei Yang <richard.weiyang@...il.com>,
David Hildenbrand <david@...hat.com>,
Miaohe Lin <linmiaohe@...wei.com>, Al Viro <viro@...iv.linux.org.uk>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] fork: Remove unnecessary size argument when calling
strscpy()
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@...ux.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
>
Powered by blists - more mailing lists