Skip to content

Commit 10de795

Browse files
Muchun Songrostedt
authored andcommitted
kprobes: Fix compiler warning for !CONFIG_KPROBES_ON_FTRACE
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] Reported-by: Stephen Rothwell <[email protected]> Fixes: 0cb2f13 ("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]>
1 parent afcab63 commit 10de795

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

kernel/kprobes.c

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1079,9 +1079,20 @@ static int disarm_kprobe_ftrace(struct kprobe *p)
10791079
ipmodify ? &kprobe_ipmodify_enabled : &kprobe_ftrace_enabled);
10801080
}
10811081
#else /* !CONFIG_KPROBES_ON_FTRACE */
1082-
#define prepare_kprobe(p) arch_prepare_kprobe(p)
1083-
#define arm_kprobe_ftrace(p) (-ENODEV)
1084-
#define disarm_kprobe_ftrace(p) (-ENODEV)
1082+
static inline int prepare_kprobe(struct kprobe *p)
1083+
{
1084+
return arch_prepare_kprobe(p);
1085+
}
1086+
1087+
static inline int arm_kprobe_ftrace(struct kprobe *p)
1088+
{
1089+
return -ENODEV;
1090+
}
1091+
1092+
static inline int disarm_kprobe_ftrace(struct kprobe *p)
1093+
{
1094+
return -ENODEV;
1095+
}
10851096
#endif
10861097

10871098
/* Arm a kprobe with text_mutex */

0 commit comments

Comments
 (0)