Re: [PATCH v8 4/5] treewide: Switch memcpy() users of 'task->comm' to a more safer implementation

From: Bhupesh Sharma
Date: Fri Aug 22 2025 - 08:08:53 EST




On 8/21/25 10:13 PM, Steven Rostedt wrote:
On Thu, 21 Aug 2025 15:51:51 +0530
Bhupesh <bhupesh@xxxxxxxxxx> wrote:

+static __always_inline void
+ __cstr_array_copy(char *dst, const char *src,
+ __kernel_size_t size)
+{
+ memcpy(dst, src, size);
+ dst[size] = 0;
Shouldn't this be: dst[size - 1] = 0;

?

Perhaps also add:

BUILD_BUG_ON(size == 0);


Ok, will add this in v9.

Thanks.