diff options
Diffstat (limited to 'meta/recipes-kernel/kexec/kexec-tools/0001-x86-x86_64-Fix-format-warning-with-die.patch')
-rw-r--r-- | meta/recipes-kernel/kexec/kexec-tools/0001-x86-x86_64-Fix-format-warning-with-die.patch | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/meta/recipes-kernel/kexec/kexec-tools/0001-x86-x86_64-Fix-format-warning-with-die.patch b/meta/recipes-kernel/kexec/kexec-tools/0001-x86-x86_64-Fix-format-warning-with-die.patch new file mode 100644 index 0000000000..e601f52757 --- /dev/null +++ b/meta/recipes-kernel/kexec/kexec-tools/0001-x86-x86_64-Fix-format-warning-with-die.patch | |||
@@ -0,0 +1,78 @@ | |||
1 | Upstream-Status: Backport | ||
2 | Signed-off-by: Jussi Kukkonen <jussi.kukkonen@intel.com> | ||
3 | |||
4 | |||
5 | From 1550f81bf1886aa0520da0b6181cd61c1a75d4ad Mon Sep 17 00:00:00 2001 | ||
6 | From: Pratyush Anand <panand@redhat.com> | ||
7 | Date: Tue, 14 Mar 2017 17:59:22 +0530 | ||
8 | Subject: [PATCH 1/2] x86/x86_64: Fix format warning with die() | ||
9 | |||
10 | Fedora koji uses gcc version 7.0.1-0.12.fc27, and it generates a build | ||
11 | warning | ||
12 | |||
13 | kexec/arch/i386/kexec-elf-x86.c:299:3: error: format not a string | ||
14 | literal and no format arguments [-Werror=format-security] | ||
15 | die(error_msg); | ||
16 | ^~~ | ||
17 | cc1: some warnings being treated as errors | ||
18 | |||
19 | error_msg can have a format specifier as well in string. In such cases, | ||
20 | if there is no other arguments for the format variable then code will | ||
21 | try to access a non existing argument. Therefore, use 1st argument as | ||
22 | format specifier for string print and pass error_msg as the string to be | ||
23 | printed. | ||
24 | |||
25 | While doing that,also use const qualifier before "char *error_msg". | ||
26 | |||
27 | Signed-off-by: Pratyush Anand <panand@redhat.com> | ||
28 | Signed-off-by: Simon Horman <horms@verge.net.au> | ||
29 | --- | ||
30 | kexec/arch/i386/kexec-elf-x86.c | 4 ++-- | ||
31 | kexec/arch/x86_64/kexec-elf-x86_64.c | 4 ++-- | ||
32 | 2 files changed, 4 insertions(+), 4 deletions(-) | ||
33 | |||
34 | diff --git a/kexec/arch/i386/kexec-elf-x86.c b/kexec/arch/i386/kexec-elf-x86.c | ||
35 | index de00dcb..fedf031 100644 | ||
36 | --- a/kexec/arch/i386/kexec-elf-x86.c | ||
37 | +++ b/kexec/arch/i386/kexec-elf-x86.c | ||
38 | @@ -91,7 +91,7 @@ int elf_x86_load(int argc, char **argv, const char *buf, off_t len, | ||
39 | char *command_line = NULL, *modified_cmdline = NULL; | ||
40 | const char *append = NULL; | ||
41 | char *tmp_cmdline = NULL; | ||
42 | - char *error_msg = NULL; | ||
43 | + const char *error_msg = NULL; | ||
44 | int result; | ||
45 | int command_line_len; | ||
46 | const char *ramdisk; | ||
47 | @@ -296,6 +296,6 @@ out: | ||
48 | free(command_line); | ||
49 | free(modified_cmdline); | ||
50 | if (error_msg) | ||
51 | - die(error_msg); | ||
52 | + die("%s", error_msg); | ||
53 | return result; | ||
54 | } | ||
55 | diff --git a/kexec/arch/x86_64/kexec-elf-x86_64.c b/kexec/arch/x86_64/kexec-elf-x86_64.c | ||
56 | index ae65692..ad22311 100644 | ||
57 | --- a/kexec/arch/x86_64/kexec-elf-x86_64.c | ||
58 | +++ b/kexec/arch/x86_64/kexec-elf-x86_64.c | ||
59 | @@ -99,7 +99,7 @@ int elf_x86_64_load(int argc, char **argv, const char *buf, off_t len, | ||
60 | #define ARG_STYLE_NONE 2 | ||
61 | int opt; | ||
62 | int result = 0; | ||
63 | - char *error_msg = NULL; | ||
64 | + const char *error_msg = NULL; | ||
65 | |||
66 | /* See options.h and add any new options there too! */ | ||
67 | static const struct option options[] = { | ||
68 | @@ -276,6 +276,6 @@ out: | ||
69 | free(command_line); | ||
70 | free(modified_cmdline); | ||
71 | if (error_msg) | ||
72 | - die(error_msg); | ||
73 | + die("%s", error_msg); | ||
74 | return result; | ||
75 | } | ||
76 | -- | ||
77 | 2.11.0 | ||
78 | |||