In message: [linux-yocto][linux-yocto v5.4/standard/base][PATCH] kprobes: Fix 
compiler warning for !CONFIG_KPROBES_ON_FTRACE
on 17/09/2020 Xulin Sun wrote:

> From: Muchun Song <[email protected]>
> 
> commit 10de795a5addd1962406796a6e13ba6cc0fc6bee upstream
> 
> Fix compiler warning(as show below) for !CONFIG_KPROBES_ON_FTRACE.
> 
> kernel/kprobes.c: In function 'kill_kprobe':
> kernel/kprobes.c:1116:33: warning: statement with no effect
> [-Wunused-value]
>  1116 | #define disarm_kprobe_ftrace(p) (-ENODEV)
>       |                                 ^
> kernel/kprobes.c:2154:3: note: in expansion of macro
> 'disarm_kprobe_ftrace'
>  2154 |   disarm_kprobe_ftrace(p);
> 
> Link: https://lore.kernel.org/r/[email protected]
> Link: 
> https://lkml.kernel.org/r/[email protected]

Looks like this should have also gone to -stable, but I've merged it
while it loops around.

Bruce

> 
> Reported-by: Stephen Rothwell <[email protected]>
> Fixes: 0cb2f1372baa ("kprobes: Fix NULL pointer dereference at 
> kprobe_ftrace_handler")
> Acked-by: Masami Hiramatsu <[email protected]>
> Acked-by: John Fastabend <[email protected]>
> Signed-off-by: Muchun Song <[email protected]>
> Signed-off-by: Steven Rostedt (VMware) <[email protected]>
> Signed-off-by: Xulin Sun <[email protected]>
> ---
>  kernel/kprobes.c | 17 ++++++++++++++---
>  1 file changed, 14 insertions(+), 3 deletions(-)
> 
> diff --git a/kernel/kprobes.c b/kernel/kprobes.c
> index bbff4bccb885..6cc1d961f56a 100644
> --- a/kernel/kprobes.c
> +++ b/kernel/kprobes.c
> @@ -1076,9 +1076,20 @@ static int disarm_kprobe_ftrace(struct kprobe *p)
>               ipmodify ? &kprobe_ipmodify_enabled : &kprobe_ftrace_enabled);
>  }
>  #else        /* !CONFIG_KPROBES_ON_FTRACE */
> -#define prepare_kprobe(p)    arch_prepare_kprobe(p)
> -#define arm_kprobe_ftrace(p) (-ENODEV)
> -#define disarm_kprobe_ftrace(p)      (-ENODEV)
> +static inline int prepare_kprobe(struct kprobe *p)
> +{
> +     return arch_prepare_kprobe(p);
> +}
> +
> +static inline int arm_kprobe_ftrace(struct kprobe *p)
> +{
> +     return -ENODEV;
> +}
> +
> +static inline int disarm_kprobe_ftrace(struct kprobe *p)
> +{
> +     return -ENODEV;
> +}
>  #endif
>  
>  /* Arm a kprobe with text_mutex */
> -- 
> 2.17.1
> 
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#9066): 
https://lists.yoctoproject.org/g/linux-yocto/message/9066
Mute This Topic: https://lists.yoctoproject.org/mt/76904129/21656
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to