Skip to content

Commit 31d1139

Browse files
committed
ftrace: Initialize variables for ftrace_startup/shutdown_subops()
The reworking to fix and simplify the ftrace_startup_subops() and the ftrace_shutdown_subops() made it possible for the filter_hash and notrace_hash variables to be used uninitialized in a way that the compiler did not catch it. Initialize both filter_hash and notrace_hash to the EMPTY_HASH as that is what they should be if they never are used. Cc: Masami Hiramatsu <mhiramat@kernel.org> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Link: https://lore.kernel.org/20250417104017.3aea66c2@gandalf.local.home Reported-by: Venkat Rao Bagalkote <venkat88@linux.ibm.com> Tested-by: Venkat Rao Bagalkote <venkat88@linux.ibm.com> Fixes: 0ae6b8c ("ftrace: Fix accounting of subop hashes") Closes: https://lore.kernel.org/all/1db64a42-626d-4b3a-be08-c65e47333ce2@linux.ibm.com/ Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
1 parent 8ffd015 commit 31d1139

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

kernel/trace/ftrace.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3490,8 +3490,8 @@ static int add_next_hash(struct ftrace_hash **filter_hash, struct ftrace_hash **
34903490
*/
34913491
int ftrace_startup_subops(struct ftrace_ops *ops, struct ftrace_ops *subops, int command)
34923492
{
3493-
struct ftrace_hash *filter_hash;
3494-
struct ftrace_hash *notrace_hash;
3493+
struct ftrace_hash *filter_hash = EMPTY_HASH;
3494+
struct ftrace_hash *notrace_hash = EMPTY_HASH;
34953495
struct ftrace_hash *save_filter_hash;
34963496
struct ftrace_hash *save_notrace_hash;
34973497
int ret;
@@ -3625,8 +3625,8 @@ static int rebuild_hashes(struct ftrace_hash **filter_hash, struct ftrace_hash *
36253625
*/
36263626
int ftrace_shutdown_subops(struct ftrace_ops *ops, struct ftrace_ops *subops, int command)
36273627
{
3628-
struct ftrace_hash *filter_hash;
3629-
struct ftrace_hash *notrace_hash;
3628+
struct ftrace_hash *filter_hash = EMPTY_HASH;
3629+
struct ftrace_hash *notrace_hash = EMPTY_HASH;
36303630
int ret;
36313631

36323632
if (unlikely(ftrace_disabled))

0 commit comments

Comments
 (0)