From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
To: Dan Carpenter <error27@gmail.com>
Cc: linux-trace-kernel@vger.kernel.org
Subject: Re: [bug report] fprobe: Skip exit_handler if entry_handler returns !0
Date: Sat, 8 Apr 2023 23:24:00 +0900 [thread overview]
Message-ID: <20230408232400.467608f3b7c809d39096d3b1@kernel.org> (raw)
In-Reply-To: <85429a5c-a4b9-499e-b6c0-cbd313291c49@kili.mountain>
Hi Dan,
Thanks for reporting!
On Tue, 4 Apr 2023 10:37:48 +0300
Dan Carpenter <error27@gmail.com> wrote:
> Hello Masami Hiramatsu (Google),
>
> The patch 39d954200bf6: "fprobe: Skip exit_handler if entry_handler
> returns !0" from Feb 2, 2023, leads to the following Smatch static
> checker warning:
>
> kernel/trace/fprobe.c:59 fprobe_handler()
> error: uninitialized symbol 'ret'.
>
> kernel/trace/fprobe.c
> 49 fpr->entry_ip = ip;
> 50 if (fp->entry_data_size)
> 51 entry_data = fpr->data;
> 52 }
> 53
> 54 if (fp->entry_handler)
> 55 ret = fp->entry_handler(fp, ip, ftrace_get_regs(fregs), entry_data);
>
> ret is only initialized if there is an ->entry_handler
>
> 56
> 57 /* If entry_handler returns !0, nmissed is not counted. */
> 58 if (rh) {
>
> rh is only true if there is an ->exit_handler. Presumably if you have
> and ->exit_handler that means you also have a ->entry_handler but Smatch
> is not smart enough to figure it out.
Ah, OK. Let me fix to initialize 'ret'.
>
> --> 59 if (ret)
> ^^^
> Warning here.
Thank you!
>
> 60 rethook_recycle(rh);
> 61 else
> 62 rethook_hook(rh, ftrace_get_regs(fregs), true);
> 63 }
> 64 out:
> 65 ftrace_test_recursion_unlock(bit);
> 66 }
>
> regards,
> dan carpenter
--
Masami Hiramatsu (Google) <mhiramat@kernel.org>
prev parent reply other threads:[~2023-04-08 14:24 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-04 7:37 [bug report] fprobe: Skip exit_handler if entry_handler returns !0 Dan Carpenter
2023-04-08 14:24 ` Masami Hiramatsu [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230408232400.467608f3b7c809d39096d3b1@kernel.org \
--to=mhiramat@kernel.org \
--cc=error27@gmail.com \
--cc=linux-trace-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).