History

kexec_file: adjust declaration of kexec_purgatory

Defining kexec_purgatory as a zero-length char array upsets compile time size checking. Since this is built on a per-arch basis, define it as an unsized char array (like is done for other similar things, e.g. linker sections). This silences the warning generated by the future CONFIG_FORTIFY_SOURCE, which did not like the memcmp() of a "0 byte" array. This drops the __weak and uses an extern instead, since both users define kexec_purgatory.

Kees Cook committed 9 years ago

Commit e2ae8ab1 parent 3e2c0442 files · +2 −7Browse files

Showing the changes to kernel (2 of 2 files). Show all

Unified · Split

2 files
  1. kernel/kexec_file.c +0 −7
  2. kernel/kexec_internal.h +2 −0
kernel/kexec_file.c+0−7
@@ -26,13 +26,6 @@ · 25 unmodified lines
2626 #include <linux/vmalloc.h>
2727 #include "kexec_internal.h"
2828
29−/*
30− * Declare these symbols weak so that if architecture provides a purgatory,
31− * these will be overridden.
32− */
33−char __weak kexec_purgatory[0];
34−size_t __weak kexec_purgatory_size = 0;
35−
3629 static int kexec_calculate_store_digests(struct kimage *image);
3730
3831 /* Architectures can provide this probe function */
kernel/kexec_internal.h+2−0
@@ -17,6 +17,8 @@ extern struct mutex kexec_mutex; · 16 unmodified lines
1717 #ifdef CONFIG_KEXEC_FILE
1818 #include <linux/purgatory.h>
1919 void kimage_file_post_load_cleanup(struct kimage *image);
20+extern char kexec_purgatory[];
21+extern size_t kexec_purgatory_size;
2022 #else /* CONFIG_KEXEC_FILE */
2123 static inline void kimage_file_post_load_cleanup(struct kimage *image) { }
2224 #endif /* CONFIG_KEXEC_FILE */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t