From 1457496452f5e6dcae10abc125dfbd9b75e4eea1 Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Thu, 8 Oct 2015 17:18:50 +0200 Subject: [PATCH] unix: squelch harmless valgrind warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Valgrind complains that the msg_control pointer points to uninitialized memory. While the memory is only used for writing data to, not for reading data from, and the warning is therefore bogus, it's still annoying enough that I decided to squelch it by zeroing the memory. The performance implications should be minimal because this code path is only used when sending over a handle to another process. The warning: ==14859== Syscall param sendmsg(msg.msg_control) points to uninitialised byte(s) ==14859== at 0x5AF1A80: __sendmsg_nocancel (in /usr/lib64/libpthread-2.21.so) ==14859== by 0x46350E: uv__write (stream.c:810) ==14859== by 0x464B24: uv_write2 (stream.c:1398) ==14859== by 0x421ACE: run_test (test-ipc-send-recv.c:104) ==14859== by 0x421DD1: run_test_ipc_send_recv_tcp (test-ipc-send-recv.c:156) ==14859== by 0x406D2F: run_test_part (runner.c:404) ==14859== by 0x4058CD: main (run-tests.c:58) ==14859== Address 0xffefff934 is on thread 1's stack ==14859== in frame #1, created by uv__write (stream.c:742) PR-URL: https://github.com/libuv/libuv/pull/565 Reviewed-By: Fedor Indutny Reviewed-By: Saúl Ibarra Corretgé --- src/unix/stream.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/unix/stream.c b/src/unix/stream.c index 7ebd9fde..7d7ab263 100644 --- a/src/unix/stream.c +++ b/src/unix/stream.c @@ -779,9 +779,9 @@ start: if (req->send_handle) { struct msghdr msg; - char scratch[64]; struct cmsghdr *cmsg; int fd_to_send = uv__handle_fd((uv_handle_t*) req->send_handle); + char scratch[64] = {0}; assert(fd_to_send >= 0);