[RFC PATCH 19/32] function_graph: Fix to check the return value of ftrace_pop_return_trace()

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

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

Fix to check the return value ('ret_stack') of ftrace_pop_return_trace()
instead of passed storage ('ret') because ret_stack becomes NULL in
error case.

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

diff --git a/kernel/trace/fgraph.c b/kernel/trace/fgraph.c
index 858fb73440ec..e51695441476 100644
--- a/kernel/trace/fgraph.c
+++ b/kernel/trace/fgraph.c
@@ -714,7 +714,7 @@ static unsigned long __ftrace_return_to_handler(struct fgraph_ret_regs *ret_regs

ret_stack = ftrace_pop_return_trace(&trace, &ret, frame_pointer);

- if (unlikely(!ret)) {
+ if (unlikely(!ret_stack)) {
ftrace_graph_stop();
WARN_ON(1);
/* Might as well panic. What else to do? */