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