All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tom Zanussi <zanussi@kernel.org>
To: rostedt@goodmis.org
Cc: mhiramat@kernel.org, linux-kernel@vger.kernel.org,
	Tom Zanussi <zanussi@kernel.org>
Subject: [PATCH 1/7] tracing: Fix smatch warning for null glob in event_hist_trigger_parse()
Date: Thu, 27 Jan 2022 15:44:15 -0600	[thread overview]
Message-ID: <96925e5c1f116654ada7ea0613d930b1266b5e1c.1643319703.git.zanussi@kernel.org> (raw)
In-Reply-To: <cover.1643319703.git.zanussi@kernel.org>
In-Reply-To: <cover.1643319703.git.zanussi@kernel.org>

The recent rename of event_hist_trigger_parse() caused smatch
re-evaluation of trace_events_hist.c and as a result an old warning
was found:

    kernel/trace/trace_events_hist.c:6174 event_hist_trigger_parse()
    error: we previously assumed 'glob' could be null (see line 6166)

glob should never be null (and apparently smatch can also figure that
out and skip the warning when using the cross-function DB (but which
can't be used with a 0day build as it takes too much time to
generate)).

Nonetheless for clarity, remove the test but add a WARN_ON() in case
the code ever changes.

Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Tom Zanussi <zanussi@kernel.org>
---
 kernel/trace/trace_events_hist.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_hist.c
index cd9610688ddc..e0860146dd39 100644
--- a/kernel/trace/trace_events_hist.c
+++ b/kernel/trace/trace_events_hist.c
@@ -6164,7 +6164,9 @@ static int event_hist_trigger_parse(struct event_command *cmd_ops,
 
 	lockdep_assert_held(&event_mutex);
 
-	if (glob && strlen(glob)) {
+	WARN_ON(!glob);
+
+	if (strlen(glob)) {
 		hist_err_clear();
 		last_cmd_set(file, param);
 	}
-- 
2.17.1


  reply	other threads:[~2022-01-27 21:44 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-27 21:44 [PATCH 0/7] tracing: Misc bugfixes Tom Zanussi
2022-01-27 21:44 ` Tom Zanussi [this message]
2022-01-27 21:44 ` [PATCH 2/7] tracing: Fix smatch warning for do while check in event_hist_trigger_parse() Tom Zanussi
2022-01-27 21:44 ` [PATCH 3/7] tracing: Propagate is_signed to expression Tom Zanussi
2022-01-27 21:44 ` [PATCH 4/7] tracing: Don't inc err_log entry count if entry allocation fails Tom Zanussi
2022-01-27 21:44 ` [PATCH 5/7] tracing: Remove size restriction on tracing_log_err cmd strings Tom Zanussi
2022-01-27 21:44 ` [PATCH 6/7] tracing: Remove size restriction on hist trigger cmd error logging Tom Zanussi
2022-01-27 21:44 ` [PATCH 7/7] tracing: Remove size restriction on synthetic event " Tom Zanussi
2022-01-27 23:26 ` [PATCH 0/7] tracing: Misc bugfixes Steven Rostedt
2022-01-27 23:50   ` Tom Zanussi

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=96925e5c1f116654ada7ea0613d930b1266b5e1c.1643319703.git.zanussi@kernel.org \
    --to=zanussi@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhiramat@kernel.org \
    --cc=rostedt@goodmis.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.