linux-trace-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
To: Dan Carpenter <dan.carpenter@linaro.org>
Cc: linux-trace-kernel@vger.kernel.org
Subject: Re: [bug report] tracing/kprobes: Add symbol counting check when module loads
Date: Sun, 21 Jul 2024 00:52:52 +0900	[thread overview]
Message-ID: <20240721005252.3a5face397b8c4f8096d363b@kernel.org> (raw)
In-Reply-To: <1c775c89-42fe-4c86-ac6d-d97170885ae8@stanley.mountain>

On Thu, 18 Jul 2024 13:30:57 -0500
Dan Carpenter <dan.carpenter@linaro.org> wrote:

> Hello Masami Hiramatsu (Google),
> 
> Commit 9d8616034f16 ("tracing/kprobes: Add symbol counting check when
> module loads") from Jul 5, 2024 (linux-next), leads to the following
> Smatch static checker warning:
> 
> 	kernel/trace/trace_kprobe.c:828 validate_probe_symbol()
> 	warn: missing error code here? 'try_module_get_by_name()' failed. 'ret' = '0'
> 
> kernel/trace/trace_kprobe.c
>     815 static int validate_probe_symbol(char *symbol)
>     816 {
>     817         struct module *mod = NULL;
>     818         char *modname = NULL, *p;
>     819         int ret = 0;
>     820 
>     821         p = strchr(symbol, ':');
>     822         if (p) {
>     823                 modname = symbol;
>     824                 symbol = p + 1;
>     825                 *p = '\0';
>     826                 mod = try_module_get_by_name(modname);
>     827                 if (!mod)
> --> 828                         goto out;
> 
> Is it intentional that "ret = 0;" here?

Yes, hm, I dropped an important message here. If you see the commit
9d8616034f16, you can see there was;

/* Return 0 (defer) if the module does not exist yet. */

So it is intentional.

But thanks for reporting. It should be cleaned up.

Thank you,

> 
>     829         }
>     830 
>     831         ret = validate_module_probe_symbol(modname, symbol);
>     832 out:
>     833         if (p)
>     834                 *p = ':';
>     835         if (mod)
>     836                 module_put(mod);
>     837         return ret;
>     838 }
> 
> regards,
> dan carpenter


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

      reply	other threads:[~2024-07-20 15:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-18 18:30 [bug report] tracing/kprobes: Add symbol counting check when module loads Dan Carpenter
2024-07-20 15:52 ` 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=20240721005252.3a5face397b8c4f8096d363b@kernel.org \
    --to=mhiramat@kernel.org \
    --cc=dan.carpenter@linaro.org \
    --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).