From: Donglin Peng <[email protected]>

When funcgraph-args and funcgraph-retaddr are both enabled, many kernel
functions display invalid parameters in trace logs[1].

The issue occurs because print_graph_retval() passes a mismatched args
pointer to print_function_args(). Fix this by retrieving the correct
args pointer using the FGRAPH_ENTRY_ARGS() macro.

[1] 
https://gitee.com/pengdonglin137/funcgraph_visualization/raw/master/samples/error_args.png
Fixes: f83ac7544fbf ("function_graph: Enable funcgraph-args and 
funcgraph-retaddr to work simultaneously")
Signed-off-by: Donglin Peng <[email protected]>
---
 kernel/trace/trace_functions_graph.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/trace/trace_functions_graph.c 
b/kernel/trace/trace_functions_graph.c
index b1e9c9913309..1de6f1573621 100644
--- a/kernel/trace/trace_functions_graph.c
+++ b/kernel/trace/trace_functions_graph.c
@@ -901,7 +901,7 @@ static void print_graph_retval(struct trace_seq *s, struct 
ftrace_graph_ent_entr
                trace_seq_printf(s, "%ps", func);
 
                if (args_size >= FTRACE_REGS_MAX_ARGS * sizeof(long)) {
-                       print_function_args(s, entry->args, (unsigned 
long)func);
+                       print_function_args(s, FGRAPH_ENTRY_ARGS(entry), 
(unsigned long)func);
                        trace_seq_putc(s, ';');
                } else
                        trace_seq_puts(s, "();");
-- 
2.34.1


Reply via email to