Re: [PATCH v3] samples/kprobes: Fix typo in handler_{post,fault}()

From: Joe Perches
Date: Sun May 16 2021 - 09:15:12 EST


On Sun, 2021-05-16 at 19:02 +0900, Masami Hiramatsu wrote:
> On Sat, 15 May 2021 10:39:06 +0800
> Tiezhu Yang <yangtiezhu@xxxxxxxxxxx> wrote:
>
> > It should use post_handler instead of pre_handler in handler_post().
> >
> > As Joe Perches suggested, it would be better to use pr_fmt and remove
> > all the embedded pre/post strings. This would change the style of the
> > output through.
> >
>
> NAK, this also shows which handler cought the event.
> If you wanna change it. Please replace it with __func__ instead.
[]
> > diff --git a/samples/kprobes/kprobe_example.c b/samples/kprobes/kprobe_example.c
[]
> > @@ -10,6 +10,8 @@
> >   * whenever kernel_clone() is invoked to create a new process.
> >   */
> >  
> > +#define pr_fmt(fmt) "%s: " fmt, __func__

It does that already via the pr_fmt which uses __func__.