x86/x86_64: Fix format warning with die()

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@redhat.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
diff --git a/kexec/arch/i386/kexec-elf-x86.c b/kexec/arch/i386/kexec-elf-x86.c
index de00dcb..fedf031 100644
--- a/kexec/arch/i386/kexec-elf-x86.c
+++ b/kexec/arch/i386/kexec-elf-x86.c
@@ -91,7 +91,7 @@
 	char *command_line = NULL, *modified_cmdline = NULL;
 	const char *append = NULL;
 	char *tmp_cmdline = NULL;
-	char *error_msg = NULL;
+	const char *error_msg = NULL;
 	int result;
 	int command_line_len;
 	const char *ramdisk;
@@ -296,6 +296,6 @@
 	free(command_line);
 	free(modified_cmdline);
 	if (error_msg)
-		die(error_msg);
+		die("%s", error_msg);
 	return result;
 }
diff --git a/kexec/arch/x86_64/kexec-elf-x86_64.c b/kexec/arch/x86_64/kexec-elf-x86_64.c
index ae65692..ad22311 100644
--- a/kexec/arch/x86_64/kexec-elf-x86_64.c
+++ b/kexec/arch/x86_64/kexec-elf-x86_64.c
@@ -99,7 +99,7 @@
 #define ARG_STYLE_NONE  2
 	int opt;
 	int result = 0;
-	char *error_msg = NULL;
+	const char *error_msg = NULL;
 
 	/* See options.h and add any new options there too! */
 	static const struct option options[] = {
@@ -276,6 +276,6 @@
 	free(command_line);
 	free(modified_cmdline);
 	if (error_msg)
-		die(error_msg);
+		die("%s", error_msg);
 	return result;
 }