From: Boqun Feng <boqun@kernel.org>
To: Peter Zijlstra <peterz@infradead.org>
Cc: "Ingo Molnar" <mingo@kernel.org>, "Will Deacon" <will@kernel.org>,
"Boqun Feng" <boqun@kernel.org>,
"Waiman Long" <longman@redhat.com>, "Gary Guo" <gary@garyguo.net>,
"Alice Ryhl" <aliceryhl@google.com>,
"Lyude Paul" <lyude@redhat.com>,
"Daniel Almeida" <daniel.almeida@collabora.com>,
"Onur Özkan" <work@onurozkan.dev>,
"Miguel Ojeda" <ojeda@kernel.org>,
"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
"Benno Lossin" <lossin@kernel.org>,
"Andreas Hindborg" <a.hindborg@kernel.org>,
"Trevor Gross" <tmgross@umich.edu>,
"Danilo Krummrich" <dakr@kernel.org>,
linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org,
"Thorsten Blum" <thorsten.blum@linux.dev>
Subject: [PATCH 2/3] locking/lockdep: Replace snprintf with strscpy in seq_stats
Date: Thu, 4 Jun 2026 22:23:30 -0700 [thread overview]
Message-ID: <20260605052331.1628-3-boqun@kernel.org> (raw)
In-Reply-To: <20260605052331.1628-1-boqun@kernel.org>
From: Thorsten Blum <thorsten.blum@linux.dev>
Replace snprintf("%s", ...) with the faster and more direct strscpy().
Reviewed-by: Waiman Long <longman@redhat.com>
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Acked-by: Waiman Long <longman@redhat.com>
Signed-off-by: Boqun Feng <boqun@kernel.org>
Link: https://patch.msgid.link/20260318001426.2664-3-thorsten.blum@linux.dev
---
kernel/locking/lockdep_proc.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/kernel/locking/lockdep_proc.c b/kernel/locking/lockdep_proc.c
index 1916db9aa46b..e458fa258d05 100644
--- a/kernel/locking/lockdep_proc.c
+++ b/kernel/locking/lockdep_proc.c
@@ -19,6 +19,7 @@
#include <linux/debug_locks.h>
#include <linux/vmalloc.h>
#include <linux/sort.h>
+#include <linux/string.h>
#include <linux/uaccess.h>
#include <asm/div64.h>
@@ -488,9 +489,9 @@ static void seq_stats(struct seq_file *m, struct lock_stat_data *data)
const char *key_name;
key_name = __get_key_name(ckey, str);
- snprintf(name, namelen, "%s", key_name);
+ strscpy(name, key_name, namelen);
} else {
- snprintf(name, namelen, "%s", cname);
+ strscpy(name, cname, namelen);
}
rcu_read_unlock_sched();
--
2.51.0
next prev parent reply other threads:[~2026-06-05 5:23 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-05 5:23 [GIT PULL] [PATCH 0/3] Rust synchronization changes for v7.2 Boqun Feng
2026-06-05 5:23 ` [PATCH 1/3] MAINTAINERS: Add RUST [SYNC] entry Boqun Feng
2026-06-05 5:23 ` Boqun Feng [this message]
2026-06-05 5:23 ` [PATCH 3/3] rust: sync: completion: Mark inline complete_all and wait_for_completion Boqun Feng
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=20260605052331.1628-3-boqun@kernel.org \
--to=boqun@kernel.org \
--cc=a.hindborg@kernel.org \
--cc=aliceryhl@google.com \
--cc=bjorn3_gh@protonmail.com \
--cc=dakr@kernel.org \
--cc=daniel.almeida@collabora.com \
--cc=gary@garyguo.net \
--cc=linux-kernel@vger.kernel.org \
--cc=longman@redhat.com \
--cc=lossin@kernel.org \
--cc=lyude@redhat.com \
--cc=mingo@kernel.org \
--cc=ojeda@kernel.org \
--cc=peterz@infradead.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=thorsten.blum@linux.dev \
--cc=tmgross@umich.edu \
--cc=will@kernel.org \
--cc=work@onurozkan.dev \
/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