Skip to contentSkip to conversation

kexec_file: adjust declaration of kexec_purgatory

PATCH New [email protected] 1 participant 1 message Jul 12, 2017 kexec

lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

PATCH 59/96 kexec_file: adjust declaration of kexec_purgatory

From: Kees Cook <[email protected]>
Subject: 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.

---

 kernel/kexec_file.c     |    7 -------
 kernel/kexec_internal.h |    2 ++
 2 files changed, 2 insertions(+), 7 deletions(-)
kernel/kexec_file.c renamed from kernel/kexec_file.c~kexec_file-adjust-declaration-of-kexec_purgatory +0 -6
diff -puN kernel/kexec_file.c~kexec_file-adjust-declaration-of-kexec_purgatory kernel/kexec_file.c
@@ -26,13 +26,6 @@
 #include <linux/vmalloc.h>
 #include "kexec_internal.h"
 
-/*
- * Declare these symbols weak so that if architecture provides a purgatory,
- * these will be overridden.
- */
-char __weak kexec_purgatory[0];
-size_t __weak kexec_purgatory_size = 0;