From: "Joel Fernandes (Google)" <joel@joelfernandes.org>
To: linux-kernel@vger.kernel.org,
Steven Rostedt <rostedt@goodmis.org>,
Masami Hiramatsu <mhiramat@kernel.org>
Cc: Xu Panda <xu.panda@zte.com.cn>,
Yang Yang <yang.yang29@zte.com.cn>,
"Paul E . McKenney" <paulmck@kernel.org>,
Joel Fernandes <joel@joelfernandes.org>,
linux-trace-kernel@vger.kernel.org
Subject: [PATCH v2 05/13] rcu/trace: use strscpy() to instead of strncpy()
Date: Sat, 25 Mar 2023 17:33:08 +0000 [thread overview]
Message-ID: <20230325173316.3118674-6-joel@joelfernandes.org> (raw)
In-Reply-To: <20230325173316.3118674-1-joel@joelfernandes.org>
From: Xu Panda <xu.panda@zte.com.cn>
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.
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>
---
include/trace/events/rcu.h | 4 +---
1 file changed, 1 insertion(+), 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;
--
2.40.0.348.gf938b09366-goog
next prev parent reply other threads:[~2023-03-25 17:34 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-25 17:33 [PATCH v2 00/13] Core RCU patches for 6.4 Joel Fernandes (Google)
2023-03-25 17:33 ` [PATCH v2 01/13] MAINTAINERS: Change Joel Fernandes from R: to M: Joel Fernandes (Google)
2023-03-26 19:19 ` Frederic Weisbecker
2023-03-25 17:33 ` [PATCH v2 02/13] MAINTAINERS: Add Boqun to RCU entry Joel Fernandes (Google)
2023-03-26 19:19 ` Frederic Weisbecker
2023-03-25 17:33 ` [PATCH v2 03/13] MAINTAINERS: Add Zqiang as a RCU reviewer Joel Fernandes (Google)
2023-03-25 17:33 ` [PATCH v2 04/13] tick/nohz: Fix cpu_is_hotpluggable() by checking with nohz subsystem Joel Fernandes (Google)
2023-03-26 19:34 ` Frederic Weisbecker
2023-03-30 15:49 ` Joel Fernandes
2023-03-25 17:33 ` Joel Fernandes (Google) [this message]
2023-03-25 17:33 ` [PATCH v2 06/13] rcu: Fix set/clear TICK_DEP_BIT_RCU_EXP bitmask race Joel Fernandes (Google)
2023-03-25 17:33 ` [PATCH v2 07/13] rcu: Fix missing TICK_DEP_MASK_RCU_EXP dependency check Joel Fernandes (Google)
2023-03-25 17:33 ` [PATCH v2 08/13] rcu: Register rcu-lazy shrinker only for CONFIG_RCU_LAZY=y kernels Joel Fernandes (Google)
2023-03-25 17:33 ` [PATCH v2 09/13] rcu: Remove never-set needwake assignment from rcu_report_qs_rdp() Joel Fernandes (Google)
2023-03-25 17:33 ` [PATCH v2 10/13] rcu: Permit start_poll_synchronize_rcu_expedited() to be invoked early Joel Fernandes (Google)
2023-03-25 17:33 ` [PATCH v2 11/13] rcu-tasks: Report stalls during synchronize_srcu() in rcu_tasks_postscan() Joel Fernandes (Google)
2023-03-26 19:53 ` Frederic Weisbecker
2023-03-25 17:33 ` [PATCH v2 12/13] rcu: Avoid stack overflow due to __rcu_irq_enter_check_tick() being kprobe-ed Joel Fernandes (Google)
2023-03-25 17:33 ` [PATCH v2 13/13] rcu: Protect rcu_print_task_exp_stall() ->exp_tasks access Joel Fernandes (Google)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230325173316.3118674-6-joel@joelfernandes.org \
--to=joel@joelfernandes.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mhiramat@kernel.org \
--cc=paulmck@kernel.org \
--cc=rostedt@goodmis.org \
--cc=xu.panda@zte.com.cn \
--cc=yang.yang29@zte.com.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®