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.
Showing the changes to kernel (2 of 2 files). Show all
Unified · Split
| @@ -26,13 +26,6 @@ · 25 unmodified lines | |||
| 26 | #include <linux/vmalloc.h> | 26 | #include <linux/vmalloc.h> |
| 27 | #include "kexec_internal.h" | 27 | #include "kexec_internal.h" |
| 28 | 28 | ||
| 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 | |||
| 36 | static int kexec_calculate_store_digests(struct kimage *image); | 29 | static int kexec_calculate_store_digests(struct kimage *image); |
| 37 | 30 | ||
| 38 | /* Architectures can provide this probe function */ | 31 | /* Architectures can provide this probe function */ |
| @@ -17,6 +17,8 @@ extern struct mutex kexec_mutex; · 16 unmodified lines | |||
| 17 | #ifdef CONFIG_KEXEC_FILE | 17 | #ifdef CONFIG_KEXEC_FILE |
| 18 | #include <linux/purgatory.h> | 18 | #include <linux/purgatory.h> |
| 19 | void kimage_file_post_load_cleanup(struct kimage *image); | 19 | void kimage_file_post_load_cleanup(struct kimage *image); |
| 20 | extern char kexec_purgatory[]; | ||
| 21 | extern size_t kexec_purgatory_size; | ||
| 20 | #else /* CONFIG_KEXEC_FILE */ | 22 | #else /* CONFIG_KEXEC_FILE */ |
| 21 | static inline void kimage_file_post_load_cleanup(struct kimage *image) { } | 23 | static inline void kimage_file_post_load_cleanup(struct kimage *image) { } |
| 22 | #endif /* CONFIG_KEXEC_FILE */ | 24 | #endif /* CONFIG_KEXEC_FILE */ |