Skip to contentSkip to conversation

x86: kprobes: Remove unused macro stack_addr

PATCH In review Chen Zhongjin 2 participants 2 messages Sep 24, 2022 – Sep 25, 2022 x86

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86: kprobes: Remove unused macro stack_addr

An unused macro reported by [-Wunused-macros].

This macro is used to access the sp in pt_regs because at that time x86_32 can only get sp by kernel_stack_pointer(regs).

'3c88c692c287 ("x86/stackframe/32: Provide consistent pt_regs")' This commit have unified the pt_regs and from them we can get sp from pt_regs with regs->sp easily. Nowhere is using this macro anymore.

Refrencing pt_regs directly is more clear. Remove this macro for code cleaning.

---
 arch/x86/kernel/kprobes/core.c | 2 --
 1 file changed, 2 deletions(-)
arch/x86/kernel/kprobes/core.c +0 -2
index 4c3c27b6aea3..eb8bc82846b9 100644
@@ -59,8 +59,6 @@
 DEFINE_PER_CPU(struct kprobe *, current_kprobe) = NULL;
 DEFINE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk);
 
-#define stack_addr(regs) ((unsigned long *)regs->sp)
-
 #define W(row, b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, ba, bb, bc, bd, be, bf)\
 	(((b0##UL << 0x0)|(b1##UL << 0x1)|(b2##UL << 0x2)|(b3##UL << 0x3) |   \
 	  (b4##UL << 0x4)|(b5##UL << 0x5)|(b6##UL << 0x6)|(b7##UL << 0x7) |   \
Signature · 1 line
2.17.1
Acked-by on v1 1/1
#1 lore raw
Quoted 11 lines · On Sat, 24 Sep 2022 15:26:29 +0800 Chen Zhongjin <[email protected]>…

An unused macro reported by [-Wunused-macros].

This macro is used to access the sp in pt_regs because at that time x86_32 can only get sp by kernel_stack_pointer(regs).

'3c88c692c287 ("x86/stackframe/32: Provide consistent pt_regs")' This commit have unified the pt_regs and from them we can get sp from pt_regs with regs->sp easily. Nowhere is using this macro anymore.

Refrencing pt_regs directly is more clear. Remove this macro for code cleaning.

Thanks for the clean up!

Thank you,

Quoted 22 lines
---
 arch/x86/kernel/kprobes/core.c | 2 --
 1 file changed, 2 deletions(-)
arch/x86/kernel/kprobes/core.c +0 -2
index 4c3c27b6aea3..eb8bc82846b9 100644
@@ -59,8 +59,6 @@
 DEFINE_PER_CPU(struct kprobe *, current_kprobe) = NULL;
 DEFINE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk);
 
-#define stack_addr(regs) ((unsigned long *)regs->sp)
-
 #define W(row, b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, ba, bb, bc, bd, be, bf)\
 	(((b0##UL << 0x0)|(b1##UL << 0x1)|(b2##UL << 0x2)|(b3##UL << 0x3) |   \
 	  (b4##UL << 0x4)|(b5##UL << 0x5)|(b6##UL << 0x6)|(b7##UL << 0x7) |   \
Signature · 1 line
2.17.1
Signature · 1 line
Masami Hiramatsu (Google) <[email protected]>