cornelisnetworks / opa-psm2

Other
37 stars 29 forks source link

fix gcc8 compilation error #25

Closed nmorey closed 5 years ago

nmorey commented 6 years ago

Compiling with gcc 8.0.1 fails with: /home/abuild/rpmbuild/BUILD/libpsm2-10.3.37/psm_utils.c: In function 'psmi_faultinj_getspec': /home/abuild/rpmbuild/BUILD/libpsm2-10.3.37/psm_utils.c:985:59: error: '%s' directive output may be truncated writing up to 127 bytes into a region of size between 110 and 237 [-Werror=format-truncation=] snprintf(fdesc, sizeof(fdesc) - 1, "Fault Injection %s <%s>", ^~ fname, fvals_str);

In file included from /usr/include/stdio.h:862,
                 from /usr/include/malloc.h:24,
                 from /home/abuild/rpmbuild/BUILD/libpsm2-10.3.37/psm_utils.c:55:
/usr/include/bits/stdio2.h:64:10: note: '__builtin___snprintf_chk' output between 20 and 274 bytes into a destination of size 255
   return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        __bos (__s), __fmt, __va_arg_pack ());

cc1: all warnings being treated as errors make[1]: *** [Makefile:522: /home/abuild/rpmbuild/BUILD/libpsm2-10.3.37/build_release/psm_utils.o] Error 1

This increases the target buffer size to remove the error

Signed-off-by: Nicolas Morey-Chaisemartin NMoreyChaisemartin@suse.com

rwmcguir commented 6 years ago

Nicolas, thank you for the patch for gcc 8.0.1, we will look at getting this in quickly.

mwheinz commented 5 years ago

Reviewing the code it appears that this change was implicitly folded into commit 8a12e84dc7e3a89eb81f7d0d2fba13c5d9d9c484 last fall.