[PATCH liburing v1 03/10] test/file-verify: Fix reading from uninitialized buffer

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

 



From: Ammar Faizi <ammarfaizi2@xxxxxxxxxxx>

Fix this:

  ==3054556== Conditional jump or move depends on uninitialised value(s)
  ==3054556==    at 0x1099DB: verify_buf (file-verify.c:48)
  ==3054556==    by 0x10A506: test (file-verify.c:449)
  ==3054556==    by 0x109353: main (file-verify.c:538)

Link: https://github.com/axboe/liburing/issues/640
Reported-by: Vitaly Chikunov <vt@xxxxxxxxxxxx>
Signed-off-by: Ammar Faizi <ammarfaizi2@xxxxxxxxxxx>
---
 test/file-verify.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/test/file-verify.c b/test/file-verify.c
index 595dafd..b1a8fd4 100644
--- a/test/file-verify.c
+++ b/test/file-verify.c
@@ -347,13 +347,16 @@ static int test(struct io_uring *ring, const char *fname, int buffered,
 				void *ptr;
 
 				t_posix_memalign(&ptr, 4096, CHUNK_SIZE / nr_vecs);
+				memset(ptr, 0, CHUNK_SIZE / nr_vecs);
 				vecs[j][i].iov_base = ptr;
 				vecs[j][i].iov_len = CHUNK_SIZE / nr_vecs;
 			}
 		}
 	} else {
-		for (j = 0; j < READ_BATCH; j++)
+		for (j = 0; j < READ_BATCH; j++) {
 			t_posix_memalign(&buf[j], 4096, CHUNK_SIZE);
+			memset(buf[j], 0, CHUNK_SIZE);
+		}
 		nr_vecs = 0;
 	}
 
-- 
Ammar Faizi




[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