Thread (11 messages) 11 messages, 5 authors, 2025-09-06

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

From: Bhupesh Sharma <hidden>
Date: 2025-08-22 12:05:38
Also in: bpf, linux-fsdevel, linux-mm, linux-perf-users, lkml


On 8/21/25 10:13 PM, Steven Rostedt wrote:
On Thu, 21 Aug 2025 15:51:51 +0530
Bhupesh [off-list ref] wrote:
quoted
+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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help