Skip to content

Commit 117221a

Browse files
author
Fabiano Rosas
committed
tests/qtest/migration: Initialize buffer in probe_o_direct_support
Valgrind complains about the probe_o_direct_support() function reading from an uninitialized buffer. For probing O_DIRECT support we don't actually need to write to the file, just make sure the pwrite call doesn't reject the write. Still, write zeroes to the buffer to suppress the warning. Reviewed-by: Philippe Mathieu-Daudé <[email protected]> Reviewed-by: Peter Xu <[email protected]> Message-Id: <[email protected]> Signed-off-by: Fabiano Rosas <[email protected]>
1 parent cd19667 commit 117221a

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

tests/qtest/migration/migration-util.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,7 @@ bool probe_o_direct_support(const char *tmpfs)
284284

285285
buf = qemu_try_memalign(len, len);
286286
g_assert(buf);
287+
memset(buf, 0, len);
287288

288289
ret = pwrite(fd, buf, len, offset);
289290
unlink(filename);

0 commit comments

Comments
 (0)