linux-trace-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH bpf] ftrace: fix incorrect hash size in register_ftrace_direct()
@ 2025-04-12 13:33 Menglong Dong
  2025-04-12 14:09 ` Steven Rostedt
  0 siblings, 1 reply; 6+ messages in thread
From: Menglong Dong @ 2025-04-12 13:33 UTC (permalink / raw)
  To: rostedt
  Cc: mhiramat, mark.rutland, mathieu.desnoyers, linux-kernel,
	linux-trace-kernel, bpf, Menglong Dong

The max ftrace hash bits is made fls(32) in register_ftrace_direct(),
which seems illogical, and it seems to be a spelling mistake.

Just fix it.

(Do I misunderstand something?)

Fixes: d05cb470663a ("ftrace: Fix modification of direct_function hash while in use")
Signed-off-by: Menglong Dong <dongml2@chinatelecom.cn>
---
 kernel/trace/ftrace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 1a48aedb5255..7697605a41e6 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -5914,7 +5914,7 @@ int register_ftrace_direct(struct ftrace_ops *ops, unsigned long addr)
 
 	/* Make a copy hash to place the new and the old entries in */
 	size = hash->count + direct_functions->count;
-	if (size > 32)
+	if (size < 32)
 		size = 32;
 	new_hash = alloc_ftrace_hash(fls(size));
 	if (!new_hash)
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-04-13  1:30 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-12 13:33 [PATCH bpf] ftrace: fix incorrect hash size in register_ftrace_direct() Menglong Dong
2025-04-12 14:09 ` Steven Rostedt
2025-04-12 14:32   ` Menglong Dong
2025-04-12 14:36     ` Menglong Dong
2025-04-12 14:45       ` Steven Rostedt
2025-04-13  1:32         ` Menglong Dong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).