[SLOF] [PATCH 2/4] romfs/tools: Silence GCC 8.1 compiler warning with FLASHFS_MAGIC
Segher Boessenkool
segher at kernel.crashing.org
Thu Jul 19 00:25:48 AEST 2018
On Wed, Jul 18, 2018 at 02:41:42PM +0200, Thomas Huth wrote:
> GCC 8.1 introduce some new warnings which affect create_crc.c. One of
> them is:
>
> create_crc.c: In function ‘createHeaderImage’:
> create_crc.c:110:2: warning: ‘strncpy’ output truncated before terminating nul
> copying 8 bytes from a string of the same length [-Wstringop-truncation]
> strncpy(uHeader.stHeader.magic, FLASHFS_MAGIC, 8);
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> Initialize the header struct statically here instead to silence the warning.
>
> Suggested-by: Segher Boessenkool <segher at kernel.crashing.org>
> Signed-off-by: Thomas Huth <thuth at redhat.com>
Looks fine, thanks!
Segher
More information about the SLOF
mailing list