[PATCH liburing 2/2] test/timeout-overflow: Fix `-Werror=maybe-uninitialized`

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
Signed-off-by: Ammar Faizi <ammar.faizi@xxxxxxxxxxxxxxxxxxxxx>
---
 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




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux