Open MPI logo

Open MPI User's Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Open MPI User's mailing list

Subject: [OMPI users] False positive from valgrind in sec_basic.c
From: W Spector (w6ws_at_[hidden])
Date: 2014-05-21 18:29:28


When running under valgrind, I get warnings from each MPI process at
MPI_Init time. The warnings come from function sec_basic.c at lines 70
and 71 (openmpi v1.8.1):

             my_cred.credential = strdup("12345");
             my_cred.size = strlen(my_cred.credential)+1; // include
the NULL

This is because strdup(3c) and strlen(3c) are apparently optimized to
use 4-byte integer loads to speed up the copy and search operations, and
"overrun" the malloced area. (In fact, since malloc tends to pad
allocations, it is safe. But valgrind doesn't know that.)

Since the "12345" appears to be a dummy string, would it be ok to add a
couple of additional characters in the strdup call to:

             my_cred.credential = strdup("1234567");

This gives an 8 byte string (counting the NULL) and quiets valgrind down.