From: akpm@linux-foundation.org Subject: [patch 59/96] kexec_file: adjust declaration of kexec_purgatory Date: Wed, 12 Jul 2017 14:35:58 -0700 Message-ID: <20170712213558.nIixGxyi-%akpm@linux-foundation.org> Reply-To: linux-kernel@vger.kernel.org Return-path: Received: from mail.linuxfoundation.org ([140.211.169.12]:54640 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752710AbdGLVgJ (ORCPT ); Wed, 12 Jul 2017 17:36:09 -0400 Sender: mm-commits-owner@vger.kernel.org List-Id: mm-commits@vger.kernel.org To: akpm@linux-foundation.org, danielmicay@gmail.com, ebiederm@xmission.com, keescook@chromium.org, mm-commits@vger.kernel.org, torvalds@linux-foundation.org From: Kees Cook 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. Link: http://lkml.kernel.org/r/1497903987-21002-4-git-send-email-keescook@chromium.org Signed-off-by: Kees Cook Acked-by: "Eric W. Biederman" Cc: Daniel Micay Signed-off-by: Andrew Morton --- kernel/kexec_file.c | 7 ------- kernel/kexec_internal.h | 2 ++ 2 files changed, 2 insertions(+), 7 deletions(-) diff -puN kernel/kexec_file.c~kexec_file-adjust-declaration-of-kexec_purgatory kernel/kexec_file.c --- a/kernel/kexec_file.c~kexec_file-adjust-declaration-of-kexec_purgatory +++ a/kernel/kexec_file.c @@ -26,13 +26,6 @@ #include #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;