ftrace: fix incorrect hash size in register_ftrace_direct()

The maximum of the ftrace hash bits is made fls(32) in
register_ftrace_direct(), which seems illogical. So, we fix it by making
the max hash bits FTRACE_HASH_MAX_BITS instead.

Link: https://lore.kernel.org/20250413014444.36724-1-dongml2@chinatelecom.cn
Fixes: d05cb470663a ("ftrace: Fix modification of direct_function hash while in use")
Signed-off-by: Menglong Dong <dongml2@chinatelecom.cn>
Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>

authored by Menglong Dong and committed by Steven Rostedt (Google) 92f1d3b4 c45c585d

+4 -3
+4 -3
kernel/trace/ftrace.c
··· 5964 5964 5965 5965 /* Make a copy hash to place the new and the old entries in */ 5966 5966 size = hash->count + direct_functions->count; 5967 - if (size > 32) 5968 - size = 32; 5969 - new_hash = alloc_ftrace_hash(fls(size)); 5967 + size = fls(size); 5968 + if (size > FTRACE_HASH_MAX_BITS) 5969 + size = FTRACE_HASH_MAX_BITS; 5970 + new_hash = alloc_ftrace_hash(size); 5970 5971 if (!new_hash) 5971 5972 goto out_unlock; 5972 5973