From: Ian Rogers <irogers@google.com>
To: linux-trace-devel@vger.kernel.org, Steven Rostedt <rostedt@goodmis.org>
Cc: Ian Rogers <irogers@google.com>
Subject: [PATCH v1] libtracefs: Fix sqlhist used uninitialized error
Date: Tue, 2 Jan 2024 09:48:16 -0800 [thread overview]
Message-ID: <20240102174817.1051566-1-irogers@google.com> (raw)
Fix the following used uninitialized error detected by clang:
```
src/tracefs-sqlhist.c:657:13: error: variable 'extra_label' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
657 | } else if (expr == table->from) {
| ^~~~~~~~~~~~~~~~~~~
src/tracefs-sqlhist.c:662:6: note: uninitialized use occurs here
662 | if (extra_label)
| ^~~~~~~~~~~
src/tracefs-sqlhist.c:657:9: note: remove the 'if' if its condition is always true
657 | } else if (expr == table->from) {
| ^~~~~~~~~~~~~~~~~~~~~~~~
src/tracefs-sqlhist.c:645:25: note: initialize the variable 'extra_label' to silence this warning
645 | const char *extra_label;
| ^
| = NULL
1 error generated.
```
Signed-off-by: Ian Rogers <irogers@google.com>
---
src/tracefs-sqlhist.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/tracefs-sqlhist.c b/src/tracefs-sqlhist.c
index 3592000..e7a4158 100644
--- a/src/tracefs-sqlhist.c
+++ b/src/tracefs-sqlhist.c
@@ -642,7 +642,7 @@ static int update_vars(struct tep_handle *tep,
enum field_type ftype = FIELD_NONE;
struct tep_event *event;
struct field *field;
- const char *extra_label;
+ const char *extra_label = NULL;
const char *label;
const char *raw = event_field->raw;
const char *event_name;
--
2.43.0.472.g3155946c3a-goog
reply other threads:[~2024-01-02 17:48 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20240102174817.1051566-1-irogers@google.com \
--to=irogers@google.com \
--cc=linux-trace-devel@vger.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 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 read-only IMAP folder(s) and NNTP newsgroup(s).