summaryrefslogtreecommitdiff
path: root/kernel/rcu/tiny.c
diff options
context:
space:
mode:
authorPaul E. McKenney <paulmck@kernel.org>2024-12-18 21:23:06 +0300
committerBoqun Feng <boqun.feng@gmail.com>2025-02-05 18:14:39 +0300
commit7acc2d90151fe6f5d8409df44e10cd24a0296e9f (patch)
tree4028ea84e0f59c4c95fb4d78380c0baa052b516e /kernel/rcu/tiny.c
parent65e6ff0f31184bd9ce01c7bfef28558e6b70f96a (diff)
downloadlinux-7acc2d90151fe6f5d8409df44e10cd24a0296e9f.tar.xz
rcutorture: Make cur_ops->format_gp_seqs take buffer length
The Tree and Tiny implementations of rcutorture_format_gp_seqs() use hard-coded constants for the length of the buffer that they format into. This is of course an accident waiting to happen, so this commit therefore makes them take a length argument. The rcutorture calling code uses ARRAY_SIZE() to safely compute this new argument. Signed-off-by: Paul E. McKenney <paulmck@kernel.org> Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
Diffstat (limited to 'kernel/rcu/tiny.c')
-rw-r--r--kernel/rcu/tiny.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/kernel/rcu/tiny.c b/kernel/rcu/tiny.c
index 8cbec3401184..8a52aca686a5 100644
--- a/kernel/rcu/tiny.c
+++ b/kernel/rcu/tiny.c
@@ -264,9 +264,9 @@ unsigned long long rcutorture_gather_gp_seqs(void)
}
EXPORT_SYMBOL_GPL(rcutorture_gather_gp_seqs);
-void rcutorture_format_gp_seqs(unsigned long long seqs, char *cp)
+void rcutorture_format_gp_seqs(unsigned long long seqs, char *cp, size_t len)
{
- snprintf(cp, 8, "g%04llx", seqs & 0xffffULL);
+ snprintf(cp, len, "g%04llx", seqs & 0xffffULL);
}
EXPORT_SYMBOL_GPL(rcutorture_format_gp_seqs);
#endif