aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2011-12-07 17:08:16 +0100
committerSverker Eriksson <[email protected]>2011-12-07 17:13:58 +0100
commitea93ca94a8a73d5e3f27f6a23cdb82870ab66da8 (patch)
treebd8000562e458aeff37e5b9eaac506362ccb02e8
parentfd73fcc88fb6ae8a034a40744906a7c945423b3e (diff)
downloadotp-ea93ca94a8a73d5e3f27f6a23cdb82870ab66da8.tar.gz
otp-ea93ca94a8a73d5e3f27f6a23cdb82870ab66da8.tar.bz2
otp-ea93ca94a8a73d5e3f27f6a23cdb82870ab66da8.zip
erts: Suppress valgrind warning about syscall sendmsg
Valgrind complains: "Syscall param socketcall.sendmsg(msg.msg_control) points to uninitialised byte(s)". Seems valgrind do not know which bytes of msg_control are padding.
-rw-r--r--erts/emulator/drivers/common/inet_drv.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/erts/emulator/drivers/common/inet_drv.c b/erts/emulator/drivers/common/inet_drv.c
index 80b2add939..8ddba39243 100644
--- a/erts/emulator/drivers/common/inet_drv.c
+++ b/erts/emulator/drivers/common/inet_drv.c
@@ -539,6 +539,13 @@ static int my_strncasecmp(const char *s1, const char *s2, size_t n)
(((unsigned char*) (s))[1] << 8) | \
(((unsigned char*) (s))[0]))
+
+#ifdef VALGRIND
+# include <valgrind/memcheck.h>
+#else
+# define VALGRIND_MAKE_MEM_DEFINED(ptr,size)
+#endif
+
/*----------------------------------------------------------------------------
** Interface constants.
**
@@ -10238,6 +10245,7 @@ static void packet_inet_command(ErlDrvData e, char* buf, int len)
cmsg.hdr.cmsg_level = IPPROTO_SCTP;
cmsg.hdr.cmsg_type = SCTP_SNDRCV;
cmsg.hdr.cmsg_len = CMSG_LEN(sizeof(*sri));
+ VALGRIND_MAKE_MEM_DEFINED(&cmsg, (char*)sri - (char*)&cmsg); /*suppress padding as "uninitialised bytes"*/
data_len = (buf + len) - ptr;
/* The whole msg.