gcc trunk fails to build kernel on PowerPC64 due to oprofile warnings

William Cohen wcohen at redhat.com
Fri Jan 27 02:46:43 AEDT 2017


On 01/25/2017 06:00 PM, Anton Blanchard wrote:
> Hi,
> 
> gcc trunk has failed to build PowerPC64 kernels for a month or so. The issue
> is in oprofile, which is common code but ends up being sucked into
> arch/powerpc and therefore subject to the -Werror applied to arch/powerpc:
>  
> linux/arch/powerpc/oprofile/../../../drivers/oprofile/oprofile_stats.c: In function ‘oprofile_create_stats_files’:
> linux/arch/powerpc/oprofile/../../../drivers/oprofile/oprofile_stats.c:55:25: error: ‘%d’ directive output may be truncated writing between 1 and 11 bytes into a region of size 7 [-Werror=format-truncation=]
>    snprintf(buf, 10, "cpu%d", i);
>                          ^~
> linux/arch/powerpc/oprofile/../../../drivers/oprofile/oprofile_stats.c:55:21: note: using the range [1, -2147483648] for directive argument
>    snprintf(buf, 10, "cpu%d", i);
>                      ^~~~~~~
> linux/arch/powerpc/oprofile/../../../drivers/oprofile/oprofile_stats.c:55:3: note: format output between 5 and 15 bytes into a destination of size 10
>    snprintf(buf, 10, "cpu%d", i);
>    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>   LD      crypto/async_tx/built-in.o
>   CC      lib/random32.o
> cc1: all warnings being treated as errors
> 
> Anton
> 
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, SlashDot.org! http://sdm.link/slashdot
> _______________________________________________
> oprofile-list mailing list
> oprofile-list at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/oprofile-list
> 

The attached patch should make the buffer large enough to eliminate the warning.

-Will
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Avoid-hypthetical-string-truncation-in-oprofile-stat.patch
Type: text/x-patch
Size: 2347 bytes
Desc: not available
URL: <http://lists.ozlabs.org/pipermail/linuxppc-dev/attachments/20170126/42c0345f/attachment.bin>


More information about the Linuxppc-dev mailing list