All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fork: Remove unnecessary size argument when calling strscpy()
@ 2025-03-11 11:05 Thorsten Blum
  2025-03-11 11:13 ` Lorenzo Stoakes
  0 siblings, 1 reply; 3+ messages in thread
From: Thorsten Blum @ 2025-03-11 11:05 UTC (permalink / raw)
  To: Andrew Morton, Lorenzo Stoakes, Christian Brauner,
	Liam R. Howlett, Suren Baghdasaryan, Wei Yang, David Hildenbrand,
	Miaohe Lin, Al Viro
  Cc: Thorsten Blum, linux-kernel

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>
---
 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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-03-18 22:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-11 11:05 [PATCH] fork: Remove unnecessary size argument when calling strscpy() Thorsten Blum
2025-03-11 11:13 ` Lorenzo Stoakes
2025-03-18 22:50   ` Thorsten Blum

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.