Skip to contentSkip to conversation

csky: stacktrace: fix usage of ftrace_graph_ret_addr()

PATCH In review Puranjay Mohan 2 participants 2 messages Jun 19, 2024 – Jun 23, 2024 C-sky architecture

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 csky: stacktrace: fix usage of ftrace_graph_ret_addr()

ftrace_graph_ret_addr() now returns the passed in return address when NULL is passed for the 'idx' paramenter. This breaks the current usage in csky's walk_stackframe()

Fix this by passing a valid integer pointer to ftrace_graph_ret_addr()

---
 arch/csky/kernel/stacktrace.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
arch/csky/kernel/stacktrace.c +2 -1
index 27ecd63e321b..1d72f18064c2 100644
@@ -17,6 +17,7 @@ void notrace walk_stackframe(struct task_struct *task, struct pt_regs *regs,
 			     bool (*fn)(unsigned long, void *), void *arg)
 {
 	unsigned long fp, sp, pc;
+	int graph_idx = 0;
 
 	if (regs) {
 		fp = frame_pointer(regs);
@@ -50,7 +51,7 @@ void notrace walk_stackframe(struct task_struct *task, struct pt_regs *regs,
 		frame = (struct stackframe *)fp;
 		sp = fp;
 		fp = frame->fp;
-		pc = ftrace_graph_ret_addr(current, NULL, frame->ra,
+		pc = ftrace_graph_ret_addr(current, &graph_idx, frame->ra,
 					   (unsigned long *)(fp - 8));
 	}
 }
Signature · 1 line
2.40.1
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Puranjay Mohan

ftrace_graph_ret_addr() now returns the passed in return address when NULL is passed for the 'idx' paramenter. This breaks the current usage in csky's walk_stackframe()

Fix this by passing a valid integer pointer to ftrace_graph_ret_addr()

LGTM, Thx!

Quoted 28 lines
---
 arch/csky/kernel/stacktrace.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
arch/csky/kernel/stacktrace.c +2 -2
index 27ecd63e321b..1d72f18064c2 100644
@@ -17,6 +17,7 @@ void notrace walk_stackframe(struct task_struct *task, struct pt_regs *regs,
                             bool (*fn)(unsigned long, void *), void *arg)
 {
        unsigned long fp, sp, pc;
+       int graph_idx = 0;
 
        if (regs) {
                fp = frame_pointer(regs);
@@ -50,7 +51,7 @@ void notrace walk_stackframe(struct task_struct *task, struct pt_regs *regs,
                frame = (struct stackframe *)fp;
                sp = fp;
                fp = frame->fp;
-               pc = ftrace_graph_ret_addr(current, NULL, frame->ra,
+               pc = ftrace_graph_ret_addr(current, &graph_idx, frame->ra,
                                           (unsigned long *)(fp - 8));
        }
 }
--

2.40.1

Signature · 2 lines
Best Regards
 Guo Ren