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 <[email protected]>

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.

[ ... ]

> 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/[email protected]?part=2

Reply via email to