Skip to content

Commit

Permalink
erts: Suppress valgrind warning about syscall sendmsg
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
sverker committed Dec 7, 2011
1 parent fd73fcc commit ea93ca9
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions erts/emulator/drivers/common/inet_drv.c
Expand Up @@ -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.
**
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit ea93ca9

Please sign in to comment.