All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCHSET liburing 0/2] Small fixes for tests
@ 2021-10-18 12:45 Ammar Faizi
  2021-10-18 12:46 ` [PATCH liburing 1/2] test/timeout: Fix `-Werror=maybe-uninitialized` Ammar Faizi
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Ammar Faizi @ 2021-10-18 12:45 UTC (permalink / raw)
  To: Jens Axboe; +Cc: Pavel Begunkov, io-uring Mailing List, zhangyi, yangerkun

 test/timeout-overflow.c | 2 +-
 test/timeout.c          | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

-- 
Ammar Faizi



^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH liburing 1/2] test/timeout: Fix `-Werror=maybe-uninitialized`
  2021-10-18 12:45 [PATCHSET liburing 0/2] Small fixes for tests Ammar Faizi
@ 2021-10-18 12:46 ` Ammar Faizi
  2021-10-18 12:46 ` [PATCH liburing 2/2] test/timeout-overflow: " Ammar Faizi
  2021-10-18 12:54 ` [PATCHSET liburing 0/2] Small fixes for tests Jens Axboe
  2 siblings, 0 replies; 4+ messages in thread
From: Ammar Faizi @ 2021-10-18 12:46 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Pavel Begunkov, io-uring Mailing List, zhangyi, yangerkun, Ammar Faizi

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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH liburing 2/2] test/timeout-overflow: Fix `-Werror=maybe-uninitialized`
  2021-10-18 12:45 [PATCHSET liburing 0/2] Small fixes for tests Ammar Faizi
  2021-10-18 12:46 ` [PATCH liburing 1/2] test/timeout: Fix `-Werror=maybe-uninitialized` Ammar Faizi
@ 2021-10-18 12:46 ` Ammar Faizi
  2021-10-18 12:54 ` [PATCHSET liburing 0/2] Small fixes for tests Jens Axboe
  2 siblings, 0 replies; 4+ messages in thread
From: Ammar Faizi @ 2021-10-18 12:46 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Pavel Begunkov, io-uring Mailing List, zhangyi, yangerkun, Ammar Faizi

Fix this:
```
  In file included from timeout-overflow.c:12:
  timeout-overflow.c: In function ‘test_timeout_overflow’:
  ../src/include/liburing.h:406:9: error: ‘num’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
    406 |         io_uring_prep_rw(IORING_OP_TIMEOUT, sqe, -1, ts, 1, count);
        |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  timeout-overflow.c:104:26: note: ‘num’ was declared here
    104 |                 unsigned num;
        |                          ^~~
```

Fixes: a4b465536021ee9c4d6d450a9461ddfc116d08b1 ("Add test for overflow of timeout request's sequence")
Cc: yangerkun <yangerkun@huawei.com>
Signed-off-by: Ammar Faizi <ammar.faizi@students.amikom.ac.id>
---
 test/timeout-overflow.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test/timeout-overflow.c b/test/timeout-overflow.c
index f952f80..671f171 100644
--- a/test/timeout-overflow.c
+++ b/test/timeout-overflow.c
@@ -101,7 +101,7 @@ static int test_timeout_overflow(void)
 
 	msec_to_ts(&ts, TIMEOUT_MSEC);
 	for (i = 0; i < 4; i++) {
-		unsigned num;
+		unsigned num = 0;
 		sqe = io_uring_get_sqe(&ring);
 		switch (i) {
 		case 0:
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCHSET liburing 0/2] Small fixes for tests
  2021-10-18 12:45 [PATCHSET liburing 0/2] Small fixes for tests Ammar Faizi
  2021-10-18 12:46 ` [PATCH liburing 1/2] test/timeout: Fix `-Werror=maybe-uninitialized` Ammar Faizi
  2021-10-18 12:46 ` [PATCH liburing 2/2] test/timeout-overflow: " Ammar Faizi
@ 2021-10-18 12:54 ` Jens Axboe
  2 siblings, 0 replies; 4+ messages in thread
From: Jens Axboe @ 2021-10-18 12:54 UTC (permalink / raw)
  To: Ammar Faizi
  Cc: Jens Axboe, Pavel Begunkov, yangerkun, zhangyi, io-uring Mailing List

On Mon, 18 Oct 2021 19:45:59 +0700, Ammar Faizi wrote:
> test/timeout-overflow.c | 2 +-
>  test/timeout.c          | 4 ++--
>  2 files changed, 3 insertions(+), 3 deletions(-)
> 

Applied, thanks!

[1/2] test/timeout: Fix `-Werror=maybe-uninitialized`
      commit: 49e3095eb27febf4dd2639430cb554a5c694ccf9
[2/2] test/timeout-overflow: Fix `-Werror=maybe-uninitialized`
      commit: b3813170f9f24f9e18f068a7a1e29747417e360c

Best regards,
-- 
Jens Axboe



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-10-18 12:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-18 12:45 [PATCHSET liburing 0/2] Small fixes for tests Ammar Faizi
2021-10-18 12:46 ` [PATCH liburing 1/2] test/timeout: Fix `-Werror=maybe-uninitialized` Ammar Faizi
2021-10-18 12:46 ` [PATCH liburing 2/2] test/timeout-overflow: " Ammar Faizi
2021-10-18 12:54 ` [PATCHSET liburing 0/2] Small fixes for tests Jens Axboe

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.