The address from ftrace_find_rec_direct() is printed directly in t_show().
This can mislead symbol offsets if it has the "jmp" bit in the last bit.

Fix this by printing the address that returned by ftrace_jmp_get().

Fixes: 25e4e3565d45 ("ftrace: Introduce FTRACE_OPS_FL_JMP")
Signed-off-by: Menglong Dong <[email protected]>
---
 kernel/trace/ftrace.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index bbb37c0f8c6c..d4c41fb76a25 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -4492,8 +4492,12 @@ static int t_show(struct seq_file *m, void *v)
                        unsigned long direct;
 
                        direct = ftrace_find_rec_direct(rec->ip);
-                       if (direct)
-                               seq_printf(m, "\n\tdirect-->%pS", (void 
*)direct);
+                       if (direct) {
+                               seq_printf(m, ftrace_is_jmp(direct) ?
+                                             "\n\tdirect(jmp)-->%pS" :
+                                             "\n\tdirect-->%pS",
+                                          (void *)ftrace_jmp_get(direct));
+                       }
                }
        }
 
-- 
2.52.0


Reply via email to