[PATCH] kprobes: Remove unnecessary ‘NULL’ values from correct_ret_addr

Li zeming posted 1 patch 2 years, 7 months ago
kernel/kprobes.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] kprobes: Remove unnecessary ‘NULL’ values from correct_ret_addr
Posted by Li zeming 2 years, 7 months ago
The 'correct_ret_addr' pointer is always set in the later code, no need
to initialize it at definition time.

Signed-off-by: Li zeming <zeming@nfschina.com>
---
 kernel/kprobes.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/kprobes.c b/kernel/kprobes.c
index db8a3aa53cf6..ec50f9f380c1 100644
--- a/kernel/kprobes.c
+++ b/kernel/kprobes.c
@@ -2007,9 +2007,9 @@ void __weak arch_kretprobe_fixup_return(struct pt_regs *regs,
 unsigned long __kretprobe_trampoline_handler(struct pt_regs *regs,
 					     void *frame_pointer)
 {
-	kprobe_opcode_t *correct_ret_addr = NULL;
 	struct kretprobe_instance *ri = NULL;
 	struct llist_node *first, *node = NULL;
+	kprobe_opcode_t *correct_ret_addr;
 	struct kretprobe *rp;
 
 	/* Find correct address and all nodes for this frame. */
-- 
2.18.2
Re: [PATCH] kprobes: Remove unnecessary ‘NULL’ values from correct_ret_addr
Posted by Masami Hiramatsu (Google) 2 years, 7 months ago
On Wed,  5 Jul 2023 03:43:59 +0800
Li zeming <zeming@nfschina.com> wrote:

> The 'correct_ret_addr' pointer is always set in the later code, no need
> to initialize it at definition time.

Indeed. Thanks!

Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>

> 
> Signed-off-by: Li zeming <zeming@nfschina.com>
> ---
>  kernel/kprobes.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/kernel/kprobes.c b/kernel/kprobes.c
> index db8a3aa53cf6..ec50f9f380c1 100644
> --- a/kernel/kprobes.c
> +++ b/kernel/kprobes.c
> @@ -2007,9 +2007,9 @@ void __weak arch_kretprobe_fixup_return(struct pt_regs *regs,
>  unsigned long __kretprobe_trampoline_handler(struct pt_regs *regs,
>  					     void *frame_pointer)
>  {
> -	kprobe_opcode_t *correct_ret_addr = NULL;
>  	struct kretprobe_instance *ri = NULL;
>  	struct llist_node *first, *node = NULL;
> +	kprobe_opcode_t *correct_ret_addr;
>  	struct kretprobe *rp;
>  
>  	/* Find correct address and all nodes for this frame. */
> -- 
> 2.18.2
> 


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