[RFC PATCH 17/32] function_graph: Fix to update curr_ret_stack with ARRAY entry size

Masami Hiramatsu (Google)
2023-11-05T16:10:04Z

From: Masami Hiramatsu (Google) <mhiramat@kernel.org>

__ftrace_return_to_handler() missed to update the curr_ret_stack when it
gets a FGRAPH_TYPE_ARRAY. Since that type entry will follows some data
words, it must update curr_ret_stack by entry size value (__get_index(val))
instead of 1.

Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
---
kernel/trace/fgraph.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kernel/trace/fgraph.c b/kernel/trace/fgraph.c
index 0f8e9f22e9e0..597250bd30dc 100644
--- a/kernel/trace/fgraph.c
+++ b/kernel/trace/fgraph.c
@@ -740,7 +740,8 @@ static unsigned long __ftrace_return_to_handler(struct fgraph_ret_regs *ret_regs
case FGRAPH_TYPE_ARRAY:
idx = __get_array(val);
fgraph_array[idx]->retfunc(&trace, fgraph_array[idx]);
- fallthrough;
+ curr_ret_stack -= __get_index(val);
+ break;
case FGRAPH_TYPE_RESERVED:
curr_ret_stack--;
break;