Would a better solution be something like:

char default_credential[8] = "12345";
char *bar = strdup(default_credential)

?


On May 22, 2014, at 12:52 AM, George Bosilca <bosi...@icl.utk.edu> wrote:

> This is more subtle that described here. It's a vectorization problem
> and frankly it should appear on all loop-based string operations and
> for most compilers (confirmed with gcc, clang and icc). The proposed
> patch is merely a band-aid ...
> 
> More info @ https://bugs.launchpad.net/ubuntu/+source/valgrind/+bug/852760.
> A better fix for this issue will be to add "-fno-builtin-strdup" to
> your CFLAGS when compiling Open MPI.
> 
>  George.
> 
> On Wed, May 21, 2014 at 5:34 PM, Ralph Castain <r...@open-mpi.org> wrote:
>> Wow, that is hilarious. I see no problem with adding the extra characters :-)
>> 
>> Scheduled it for 1.8.2 (copied you on ticket)
>> 
>> 
>> On May 21, 2014, at 3:29 PM, W Spector <w...@earthlink.net> wrote:
>> 
>>> Hi,
>>> 
>>> 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.
>>> 
>>> Walter
>>> _______________________________________________
>>> users mailing list
>>> us...@open-mpi.org
>>> http://www.open-mpi.org/mailman/listinfo.cgi/users
>> 
>> _______________________________________________
>> users mailing list
>> us...@open-mpi.org
>> http://www.open-mpi.org/mailman/listinfo.cgi/users
> _______________________________________________
> users mailing list
> us...@open-mpi.org
> http://www.open-mpi.org/mailman/listinfo.cgi/users


-- 
Jeff Squyres
jsquy...@cisco.com
For corporate legal information go to: 
http://www.cisco.com/web/about/doing_business/legal/cri/

Reply via email to