All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ammar Faizi <ammar.faizi@students.amikom.ac.id>
To: Jens Axboe <axboe@kernel.dk>
Cc: Pavel Begunkov <asml.silence@gmail.com>,
	io-uring Mailing List <io-uring@vger.kernel.org>,
	zhangyi <yi.zhang@huawei.com>, yangerkun <yangerkun@huawei.com>,
	Ammar Faizi <ammar.faizi@students.amikom.ac.id>
Subject: [PATCH liburing 1/2] test/timeout: Fix `-Werror=maybe-uninitialized`
Date: Mon, 18 Oct 2021 19:46:00 +0700	[thread overview]
Message-ID: <hgUsvvrR9xY-ammarfaizi2@gnuweeb.org> (raw)
In-Reply-To: <DdOIWk8hb7I-ammarfaizi2@gnuweeb.org>

Fix this:
```
  timeout.c: In function ‘test_multi_timeout’:
  timeout.c:590:20: warning: ‘user_data’ may be used uninitialized in this function [-Wmaybe-uninitialized]
    590 |                 if (cqe->user_data != user_data) {
        |                    ^
  timeout.c:601:51: warning: ‘time’ may be used uninitialized in this function [-Wmaybe-uninitialized]
    601 |                 if (exp < time / 2 || exp > (time * 3) / 2) {
        |                                             ~~~~~~^~~~
```

Fixes: 37136cb4423b27dac2fc663b6a0c513b6d7d7ad1 ("test/timeout: add multi timeout reqs test with different timeout")
Cc: zhangyi (F) <yi.zhang@huawei.com>
Signed-off-by: Ammar Faizi <ammar.faizi@students.amikom.ac.id>
---
 test/timeout.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/test/timeout.c b/test/timeout.c
index f8ba973..8c35b00 100644
--- a/test/timeout.c
+++ b/test/timeout.c
@@ -563,8 +563,8 @@ static int test_multi_timeout(struct io_uring *ring)
 
 	gettimeofday(&tv, NULL);
 	for (i = 0; i < 2; i++) {
-		unsigned int time;
-		__u64 user_data;
+		unsigned int time = 0;
+		__u64 user_data = 0;
 
 		ret = io_uring_wait_cqe(ring, &cqe);
 		if (ret < 0) {
-- 
2.30.2


  reply	other threads:[~2021-10-18 12:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-18 12:45 [PATCHSET liburing 0/2] Small fixes for tests Ammar Faizi
2021-10-18 12:46 ` Ammar Faizi [this message]
2021-10-18 12:46 ` [PATCH liburing 2/2] test/timeout-overflow: Fix `-Werror=maybe-uninitialized` Ammar Faizi
2021-10-18 12:54 ` [PATCHSET liburing 0/2] Small fixes for tests Jens Axboe

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=hgUsvvrR9xY-ammarfaizi2@gnuweeb.org \
    --to=ammar.faizi@students.amikom.ac.id \
    --cc=asml.silence@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=io-uring@vger.kernel.org \
    --cc=yangerkun@huawei.com \
    --cc=yi.zhang@huawei.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 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.