Thread (4 messages) 4 messages, 3 authors, 2024-11-01

Re: [PATCH v2] tracing: Replace strncpy() with strscpy() when copying comm

From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Date: 2024-10-31 15:13:49
Also in: lkml

On 2024-10-31 08:01, Jinjie Ruan wrote:
quoted hunk ↗ jump to hunk
Replace the depreciated[1] strncpy() calls with strscpy()
when copying comm.

Link: https://github.com/KSPP/linux/issues/90 [1]
Signed-off-by: Jinjie Ruan <redacted>
---
v2:
- Fix the trace_events_hist.c build problem.
---
  kernel/trace/trace.c              | 2 +-
  kernel/trace/trace_events_hist.c  | 4 ++--
  kernel/trace/trace_sched_switch.c | 2 +-
  3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index a8f52b6527ca..cb2c66554212 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -1934,7 +1934,7 @@ __update_max_tr(struct trace_array *tr, struct task_struct *tsk, int cpu)
  	max_data->critical_start = data->critical_start;
  	max_data->critical_end = data->critical_end;
  
-	strncpy(max_data->comm, tsk->comm, TASK_COMM_LEN);
+	strscpy(max_data->comm, tsk->comm);
make allyesconfig + make please ?

Thanks,

Mathieu



-- 
Mathieu Desnoyers
EfficiOS Inc.
https://www.efficios.com
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help