From 117221ad999a3d027d38ae9ddbaa94d4e1d6a303 Mon Sep 17 00:00:00 2001 From: Fabiano Rosas Date: Mon, 9 Dec 2024 17:44:23 -0300 Subject: [PATCH] tests/qtest/migration: Initialize buffer in probe_o_direct_support MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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é Reviewed-by: Peter Xu Message-Id: <20241209204427.17763-3-farosas@suse.de> Signed-off-by: Fabiano Rosas --- tests/qtest/migration/migration-util.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/qtest/migration/migration-util.c b/tests/qtest/migration/migration-util.c index 525bf1eed4..401fe27f00 100644 --- a/tests/qtest/migration/migration-util.c +++ b/tests/qtest/migration/migration-util.c @@ -284,6 +284,7 @@ bool probe_o_direct_support(const char *tmpfs) buf = qemu_try_memalign(len, len); g_assert(buf); + memset(buf, 0, len); ret = pwrite(fd, buf, len, offset); unlink(filename); -- 2.30.2