linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ian Rogers <irogers@google.com>
To: linux-trace-devel@vger.kernel.org,
	Tzvetomir Stoyanov <tz.stoyanov@gmail.com>,
	Steven Rostedt <rostedt@goodmis.org>
Cc: Ian Rogers <irogers@google.com>
Subject: [PATCH 2/3] libtracefs utest: Fix a sometimes uninitialized variable.
Date: Thu, 22 Apr 2021 20:54:37 -0700	[thread overview]
Message-ID: <20210423035438.2221760-2-irogers@google.com> (raw)
In-Reply-To: <20210423035438.2221760-1-irogers@google.com>

The warning looks like:

utest/tracefs-utest.c:706:7: error: variable 'fd' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
                if (rstat != -1)
                    ^~~~~~~~~~~

Signed-off-by: Ian Rogers <irogers@google.com>
---
 utest/tracefs-utest.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/utest/tracefs-utest.c b/utest/tracefs-utest.c
index c5efd5f..a0d911b 100644
--- a/utest/tracefs-utest.c
+++ b/utest/tracefs-utest.c
@@ -659,7 +659,7 @@ static bool check_option(struct tracefs_instance *instance,
 	bool supported;
 	struct stat st;
 	char buf[10];
-	int fd;
+	int fd = 0;
 	int r;
 	int rstat;
 
-- 
2.31.1.498.g6c1eba8ee3d-goog


  reply	other threads:[~2021-04-23  3:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-23  3:54 [PATCH 1/3] libtracefs utest: Silence string-plus-int warnings Ian Rogers
2021-04-23  3:54 ` Ian Rogers [this message]
2021-04-23  3:54 ` [PATCH 3/3] libtracefs utest: Make a null string fatal if it is passed to strstr Ian Rogers
2021-04-26 11:25 ` [PATCH 1/3] libtracefs utest: Silence string-plus-int warnings Tzvetomir Stoyanov
2021-04-26 15:16   ` Ian Rogers

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=20210423035438.2221760-2-irogers@google.com \
    --to=irogers@google.com \
    --cc=linux-trace-devel@vger.kernel.org \
    --cc=rostedt@goodmis.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).