[PATCH liburing v1 02/10] test/eeed8b54e0df: Initialize the `malloc()`ed buffer before `write()`

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

 



From: Ammar Faizi <ammarfaizi2@xxxxxxxxxxx>

... to avoid valgrind's complaint:

  ==3054187== Syscall param write(buf) points to uninitialised byte(s)
  ==3054187==    at 0x4958E63: write (write.c:26)
  ==3054187==    by 0x109283: get_file_fd (eeed8b54e0df.c:36)
  ==3054187==    by 0x109283: main (eeed8b54e0df.c:85)
  ==3054187==  Address 0x4a63080 is 0 bytes inside a block of size 4,096 alloc'd
  ==3054187==    at 0x484479B: malloc (vg_replace_malloc.c:380)
  ==3054187==    by 0x109698: t_malloc (helpers.c:22)
  ==3054187==    by 0x109270: get_file_fd (eeed8b54e0df.c:35)
  ==3054187==    by 0x109270: main (eeed8b54e0df.c:85)

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

diff --git a/test/eeed8b54e0df.c b/test/eeed8b54e0df.c
index b388b12..b8149f2 100644
--- a/test/eeed8b54e0df.c
+++ b/test/eeed8b54e0df.c
@@ -33,6 +33,7 @@ static int get_file_fd(void)
 	}
 
 	buf = t_malloc(BLOCK);
+	memset(buf, 0, BLOCK);
 	ret = write(fd, buf, BLOCK);
 	if (ret != BLOCK) {
 		if (ret < 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