kexec-tools/0030-x86-x86_64-Fix-format-warning-with-die.patch
Tony Jones 080f64dafa Accepting request 500203 from home:tiwai:branches:Kernel:kdump
- Update to version 2.0.14 (bsc#1039937, FATE#320672, FATE#320671)
  Changelog: http://git.kernel.org/cgit/utils/kernel/kexec/kexec-tools.git/log/?id=refs/tags/v2.0.13..v2.0.14
- Backport upstream fixes  (bsc#1039937, FATE#320672, FATE#320671)
  0001-kexec-tools-2.0.14.git.patch
  0002-ppc64-Reduce-number-of-ELF-LOAD-segments.patch
  0003-kexec-Increase-the-upper-limit-for-RAM-segments.patch
  0004-alpha-add-missing-__NR_kexec_load-definition.patch
  0005-kexec-implemented-XEN-KEXEC-STATUS-to-determine-if-a.patch
  0006-kexec-Remove-redundant-space-from-help-message.patch
  0007-purgatory-Add-purgatory.map-and-purgatory.ro.sym-to-.patch
  0008-kexec-Add-option-to-get-crash-kernel-region-size.patch
  0009-crashdump-arm-Add-get_crash_kernel_load_range-functi.patch
  0010-crashdump-arm64-Add-get_crash_kernel_load_range-func.patch
  0011-crashdump-cris-Add-get_crash_kernel_load_range-funct.patch
  0012-crashdump-ia64-Add-get_crash_kernel_load_range-funct.patch
  0013-crashdump-m68k-Add-get_crash_kernel_load_range-funct.patch
  0014-crashdump-mips-Add-get_crash_kernel_load_range-funct.patch
  0015-crashdump-ppc-Add-get_crash_kernel_load_range-functi.patch
  0016-crashdump-ppc64-Add-get_crash_kernel_load_range-func.patch
  0017-crashdump-s390-Add-get_crash_kernel_load_range-funct.patch
  0018-crashdump-sh-Add-get_crash_kernel_load_range-functio.patch
  0019-gitignore-add-two-generated-files-in-purgatory.patch
  0020-Only-print-debug-message-when-failed-to-serach-for-k.patch
  0021-build_mem_phdrs-check-if-p_paddr-is-invalid.patch
  0022-uImage-fix-realloc-pointer-confusion.patch
  0023-uImage-Fix-uImage_load-for-little-endian-machines.patch
  0024-uImage-Add-new-IH_ARCH_xxx-definitions.patch
  0025-uImage-use-char-instead-of-unsigned-char-for-uImage_.patch
  0026-uImage-use-char-instead-of-unsigned-char-for-uImage_.patch
  0027-arm64-add-uImage-support.patch

OBS-URL: https://build.opensuse.org/request/show/500203
OBS-URL: https://build.opensuse.org/package/show/Kernel:kdump/kexec-tools?expand=0&rev=83
2017-05-31 20:00:34 +00:00

75 lines
2.4 KiB
Diff

From 1550f81bf1886aa0520da0b6181cd61c1a75d4ad Mon Sep 17 00:00:00 2001
From: Pratyush Anand <panand@redhat.com>
Date: Tue, 14 Mar 2017 17:59:22 +0530
Subject: [PATCH 30/45] 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>
---
kexec/arch/i386/kexec-elf-x86.c | 4 ++--
kexec/arch/x86_64/kexec-elf-x86_64.c | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/kexec/arch/i386/kexec-elf-x86.c b/kexec/arch/i386/kexec-elf-x86.c
index de00dcb869d7..fedf031cdf4a 100644
--- a/kexec/arch/i386/kexec-elf-x86.c
+++ b/kexec/arch/i386/kexec-elf-x86.c
@@ -91,7 +91,7 @@ int elf_x86_load(int argc, char **argv, const char *buf, off_t len,
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 @@ out:
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 ae6569220bc8..ad2231193eb1 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 @@ int elf_x86_64_load(int argc, char **argv, const char *buf, off_t len,
#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 @@ out:
free(command_line);
free(modified_cmdline);
if (error_msg)
- die(error_msg);
+ die("%s", error_msg);
return result;
}
--
2.13.0