diff mbox series

[liburing,v1,05/10] test/fpos: Fix reading from uninitialized buffer

Message ID 20220810002735.2260172-6-ammar.faizi@intel.com (mailing list archive)
State New
Headers show
Series liburing test fixes | expand

Commit Message

Ammar Faizi Aug. 10, 2022, 12:31 a.m. UTC
From: Ammar Faizi <ammarfaizi2@gnuweeb.org>

Fix this:

  ==3054875== Conditional jump or move depends on uninitialised value(s)
  ==3054875==    at 0x109898: test_read (fpos.c:109)
  ==3054875==    by 0x109898: main (fpos.c:243)
  ==3054875==
  ==3054875== Conditional jump or move depends on uninitialised value(s)
  ==3054875==    at 0x10987B: test_read (fpos.c:111)
  ==3054875==    by 0x10987B: main (fpos.c:243)

Link: https://github.com/axboe/liburing/issues/640
Reported-by: Vitaly Chikunov <vt@altlinux.org>
Signed-off-by: Ammar Faizi <ammarfaizi2@gnuweeb.org>
---
 test/fpos.c | 3 +++
 1 file changed, 3 insertions(+)
diff mbox series

Patch

diff --git a/test/fpos.c b/test/fpos.c
index 4ffa22d..4c36f11 100644
--- a/test/fpos.c
+++ b/test/fpos.c
@@ -52,6 +52,9 @@  static int test_read(struct io_uring *ring, bool async, int blocksize)
 	unsigned char buff[QUEUE_SIZE * blocksize];
 	unsigned char reordered[QUEUE_SIZE * blocksize];
 
+	memset(buff, 0, QUEUE_SIZE * blocksize);
+	memset(reordered, 0, QUEUE_SIZE * blocksize);
+
 	create_file(".test_fpos_read", FILE_SIZE);
 	fd = open(".test_fpos_read", O_RDONLY);
 	unlink(".test_fpos_read");