[PATCH] x86/x86_64: Fix format warning with die()
Simon Horman
horms at verge.net.au
Tue Mar 14 06:39:13 PDT 2017
On Tue, Mar 14, 2017 at 05:59:22PM +0530, Pratyush Anand wrote:
> Fedora koji uses gcc version 7.0.1-0.12.fc27, and it generates a build
> warning
>
> kexec/arch/i386/kexec-elf-x86.c:299:3: error: format not a string
> literal and no format arguments [-Werror=format-security]
> die(error_msg);
> ^~~
> cc1: some warnings being treated as errors
>
> error_msg can have a format specifier as well in string. In such cases,
> if there is no other arguments for the format variable then code will
> try to access a non existing argument. Therefore, use 1st argument as
> format specifier for string print and pass error_msg as the string to be
> printed.
>
> While doing that,also use const qualifier before "char *error_msg".
>
> Signed-off-by: Pratyush Anand <panand at redhat.com>
Thanks, applied.
More information about the kexec
mailing list