[cfe-dev] warning spew from cddl libnvpair.c

"C. Bergström" cbergstrom at pathscale.com
Thu Oct 24 21:33:15 PDT 2013


On 10/25/13 10:49 AM, Sean Bruno wrote:
> libnvpair.c has some macros and preprocessor directives that make
> clang's -Wformat-security very unhappy.
>
> /home/sbruno/bsd/head/cddl/lib/libnvpair/../../../cddl/contrib/opensolaris/lib/libnvpair/libnvpair.c:245:1: warning: format string is not a string literal (po
> tentially insecure) [-Wformat-security]
> NVLIST_ARRPRTFUNC(byte_array, uchar_t, uchar_t, "0x%2.2x")
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> /home/sbruno/bsd/head/cddl/lib/libnvpair/../../../cddl/contrib/opensolaris/lib/libnvpair/libnvpair.c:238:23: note: expanded from macro 'NVLIST_ARRPRTFUNC'
>                          (void) fprintf(fp, pctl->nvprt_btwnarrfmt); \
>
>
> I don't see a real graceful way out of this.  Also, this is totally
> "legit" C, so I don't see any reason to generate these warnings.  Can
> someone educate me on either:
>    1.  fixing these warnings the right way
>    2.  how to disable the warning flags/makefile magic
One of our friends working on FBSD is having the above issue. Cross 
posting in case anyone here is familiar with this issue.

Thanks




More information about the cfe-dev mailing list