On Mon, Aug 11, 2025 at 12:16:09PM +0530, Bhupesh wrote:
> As Linus mentioned in [1], currently we have several memcpy() use-cases
> which use 'current->comm' to copy the task name over to local copies.
> For an example:
>
> ...
> char comm[TASK_COMM_LEN];
> memcpy(comm, current->comm, TASK_COMM_LEN);
> ...
>
> These should be rather calling a wrappper like "get_task_array()",
> which is implemented as:
>
> static __always_inline void
> __cstr_array_copy(char *dst,
> const char *src, __kernel_size_t size)
> {
> memcpy(dst, src, size);
> dst[size] = 0;
> }
>
> #define get_task_array(dst,src) \
> __cstr_array_copy(dst, src, __must_be_array(dst))
>
> The relevant 'memcpy()' users were identified using the following search
> pattern:
> $ git grep 'memcpy.*->comm\>'
> [1].
> https://lore.kernel.org/all/CAHk-=wi5c=_-FBGo_88CowJd_F-Gi6Ud9d=talm65ren7yj...@mail.gmail.com/
>
> Signed-off-by: Bhupesh <[email protected]>
Same suggestion, make it a Link tag.
--
With Best Regards,
Andy Shevchenko