[PATCH bpf] ftrace: fix incorrect hash size in register_ftrace_direct()
From: Menglong Dong
Date: Sat Apr 12 2025 - 09:34:09 EST
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@xxxxxxxxxxxxxxx>
---
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