Thread (11 messages) flat view 11 messages, 2 authors, 12d ago

Re: [PATCH v6 2/6] treewide: Replace memcpy(..., current->comm) with copy_task_comm()

From: sashiko-bot@kernel.org
Date: 2026-09-10 16:59:02

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] Incorrect argument passed to copy_task_comm() causes a compilation failure due to a type mismatch.
--

commit 78bb0b12f82412f87836e6af88b5c97b35cbb5ab
Author: André Almeida [off-list ref]

treewide: Replace memcpy(..., current->comm) with copy_task_comm()

This commit introduces a new copy_task_comm() function that safely copies
a task's comm string while ensuring it is NUL terminated. It then replaces
various treewide instances of memcpy() copying task comms with this new
function to prevent truncation issues.

[ ... ]
quoted hunk ↗ jump to hunk
diff --git a/tools/testing/selftests/bpf/test_kmods/bpf_testmod-events.h b/tools/testing/selftests/bpf/test_kmods/bpf_testmod-events.h
index 45a5e41f3a920..27a1c12799cf6 100644
--- a/tools/testing/selftests/bpf/test_kmods/bpf_testmod-events.h
+++ b/tools/testing/selftests/bpf/test_kmods/bpf_testmod-events.h
@@ -20,7 +20,7 @@ TRACE_EVENT(bpf_testmod_test_read,
 	),
 	TP_fast_assign(
 		__entry->pid = task->pid;
-		memcpy(__entry->comm, task->comm, TASK_COMM_LEN);
+		copy_task_comm(__entry->comm, task->comm, TASK_COMM_LEN);
[Severity: Low]
Does this cause a build failure when compiling the bpf_testmod kernel module?

The new copy_task_comm() function expects a struct task_struct pointer as
its second argument, but task->comm (a char pointer) is being passed here
causing a type mismatch. Should this be updated to pass just task instead?
 		__entry->off = ctx->off;
 		__entry->len = ctx->len;
 	),
-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260910-tonyk-long_name-v6-0-d70afbf194c5@igalia.com?part=2
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help