Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ftrace: Comment that ftrace_func_mapper is freed with free_ftrace_hash()

The structure ftrace_func_mapper only contains a single field and that is
a ftrace_hash. It is used to abstract it out from a normal hash to control
users of how it gets modified.

The freeing of a ftrace_func_mapper structure is:

free_ftrace_hash(&mapper->hash);

Without context, this looks like a bug. It should be commented that it is
not a bug and it is freed this way.

Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Link: https://lore.kernel.org/20250416165420.5c717420@gandalf.local.home
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>

+6 -1
+6 -1
kernel/trace/ftrace.c
··· 5208 5208 void *data; 5209 5209 }; 5210 5210 5211 + /* 5212 + * Note, ftrace_func_mapper is freed by free_ftrace_hash(&mapper->hash). 5213 + * The hash field must be the first field. 5214 + */ 5211 5215 struct ftrace_func_mapper { 5212 - struct ftrace_hash hash; 5216 + struct ftrace_hash hash; /* Must be first! */ 5213 5217 }; 5214 5218 5215 5219 /** ··· 5348 5344 } 5349 5345 } 5350 5346 } 5347 + /* This also frees the mapper itself */ 5351 5348 free_ftrace_hash(&mapper->hash); 5352 5349 } 5353 5350