From: Dan Carpenter <dan.carpenter@oracle.com>
To: tz.stoyanov@gmail.com
Cc: kernel-janitors@vger.kernel.org
Subject: [bug report] tracing: Add a probe that attaches to trace events
Date: Tue, 24 Aug 2021 12:07:26 +0300 [thread overview]
Message-ID: <20210824090726.GA18835@kili> (raw)
Hello Tzvetomir Stoyanov (VMware),
This is a semi-automatic email about new static checker warnings.
The patch 7491e2c44278: "tracing: Add a probe that attaches to trace
events" from Aug 19, 2021, leads to the following Smatch complaint:
kernel/trace/trace_eprobe.c:674 enable_trace_eprobe()
warn: variable dereferenced before check 'file' (see line 664)
kernel/trace/trace_eprobe.c
638 static int enable_trace_eprobe(struct trace_event_call *call,
639 struct trace_event_file *file)
640 {
641 struct trace_probe *pos, *tp;
642 struct trace_eprobe *ep;
643 bool enabled;
644 int ret = 0;
645
646 tp = trace_probe_primary_from_call(call);
647 if (WARN_ON_ONCE(!tp))
648 return -ENODEV;
649 enabled = trace_probe_is_enabled(tp);
650
651 /* This also changes "enabled" state */
652 if (file) {
653 ret = trace_probe_add_file(tp, file);
654 if (ret)
655 return ret;
656 } else
657 trace_probe_set_flag(tp, TP_FLAG_PROFILE);
658
659 if (enabled)
660 return 0;
661
662 list_for_each_entry(pos, trace_probe_probe_list(tp), list) {
663 ep = container_of(pos, struct trace_eprobe, tp);
664 ret = enable_eprobe(ep, file);
^^^^
"file" is dereferenced here.
665 if (ret)
666 break;
667 enabled = true;
668 }
669
670 if (ret) {
671 /* Failed to enable one of them. Roll back all */
672 if (enabled)
673 disable_eprobe(ep, file->tr);
674 if (file)
^^^^
This check is too late.
675 trace_probe_remove_file(tp, file);
676 else
regards,
dan carpenter
next reply other threads:[~2021-08-24 9:07 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-24 9:07 Dan Carpenter [this message]
2021-08-24 11:42 [bug report] tracing: Add a probe that attaches to trace events Dan Carpenter
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=20210824090726.GA18835@kili \
--to=dan.carpenter@oracle.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=tz.stoyanov@gmail.com \
/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).