summaryrefslogtreecommitdiff
path: root/include/trace
diff options
context:
space:
mode:
authorXu Panda <xu.panda@zte.com.cn>2023-01-05 20:17:57 +0800
committerJoel Fernandes (Google) <joel@joelfernandes.org>2023-04-05 13:47:43 +0000
commit16d78e8cda8b4447812f375480c8cb780f396c1e (patch)
tree52e3e9f76c0d78c5690c8c3f3ee526a6135f70c6 /include/trace
parent58d7668242647e661a20efe065519abd6454287e (diff)
rcu/trace: use strscpy() to instead of strncpy()
This commit saves a line of code by switching from strncpy() to strscpy() by permitting the later NUL assignment to be removed. While in the area, save another line by taking advantage of 100 characters. Acked-by: Joel Fernandes (Google) <joel@joelfernandes.org> Signed-off-by: Xu Panda <xu.panda@zte.com.cn> Signed-off-by: Yang Yang <yang.yang29@zte.com.cn> Signed-off-by: Paul E. McKenney <paulmck@kernel.org> Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
Diffstat (limited to 'include/trace')
-rw-r--r--include/trace/events/rcu.h4
1 files changed, 1 insertions, 3 deletions
diff --git a/include/trace/events/rcu.h b/include/trace/events/rcu.h
index 90b2fb0292cb..c19ac1fa8a60 100644
--- a/include/trace/events/rcu.h
+++ b/include/trace/events/rcu.h
@@ -776,9 +776,7 @@ TRACE_EVENT_RCU(rcu_torture_read,
),
TP_fast_assign(
- strncpy(__entry->rcutorturename, rcutorturename,
- RCUTORTURENAME_LEN);
- __entry->rcutorturename[RCUTORTURENAME_LEN - 1] = 0;
+ strscpy(__entry->rcutorturename, rcutorturename, RCUTORTURENAME_LEN);
__entry->rhp = rhp;
__entry->secs = secs;
__entry->c_old = c_old;