From patchwork Wed Apr 4 22:38:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King (Oracle)" X-Patchwork-Id: 10323543 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4751660318 for ; Wed, 4 Apr 2018 22:39:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2F93228DCA for ; Wed, 4 Apr 2018 22:39:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2318B2904B; Wed, 4 Apr 2018 22:39:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 7D33F28DCA for ; Wed, 4 Apr 2018 22:39:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=UhqjzkRr6WgasUYa/98HW+zKdMI03rmrwPytgN8yfRg=; b=faK6P2I8V8olYJ AMKvUYtLazhLDjh3TQgNC+D/GZV+0YxydWCFzTZSGbHdwLj36j0f0pputEy1R4qUqDTzW3/4b7DiX VcfuZAReyNszO1AGzfTtUfo3U0qEGmI4GBEfbJlHmMTu+X+oGNLDs3EjynC44RrY1A+H529ACZodt jCWdIEwDA+vTABq7vMI3S0f1qDSaG71GRT3dWhm0xie3A8pZn9073Ph6XvdN0OOSKRp8YurZtq6gu SlwO5FEJiXtLgKaPP0qWmaNzanpKnlSAMJo2APECp+rIk+aSVBqEEXT5CQC46JNauXf6kj+MW46V2 uOEbFEi400Leqodd1M4A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1f3r3i-0007M4-Bf; Wed, 04 Apr 2018 22:39:14 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:3201:214:fdff:fe10:1be6]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1f3r3e-0007JR-8i for linux-arm-kernel@lists.infradead.org; Wed, 04 Apr 2018 22:39:12 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2014; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=uWcTtOyiZMPgtGNUfbJQlxhBnM9TwSr49vC2Ou1TesI=; b=IdG4hkp5NP9wBkqoadXyLC3Jd Zf/OXuaN8GAYP0R3eZPZ/xl7QYdyXzT6O1vEpNimLyymdKO4WlcoluCRCv1CtxOq/Lkic8gvSqg6g UVEl3ix3wuUkQ8I1oDJMgnVb7lCTZPFJ+jbB/KitmFYV8OKJ0Yqt0FK0l+yBWuzhMQDSM=; Received: from n2100.armlinux.org.uk ([2002:4e20:1eda:1:214:fdff:fe10:4f86]:37014) by pandora.armlinux.org.uk with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.90_1) (envelope-from ) id 1f3r3H-0001OQ-VG; Wed, 04 Apr 2018 23:38:48 +0100 Received: from linux by n2100.armlinux.org.uk with local (Exim 4.90_1) (envelope-from ) id 1f3r3F-0005to-8y; Wed, 04 Apr 2018 23:38:45 +0100 Date: Wed, 4 Apr 2018 23:38:44 +0100 From: Russell King - ARM Linux To: Kees Cook Subject: Re: [PATCH] arm: decompressor: mark error() as __noreturn Message-ID: <20180404223843.GL16141@n2100.armlinux.org.uk> References: <20180404123117.3575773-1-arnd@arndb.de> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180404_153910_311454_E4256A16 X-CRM114-Status: GOOD ( 19.11 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jinbum Park , linux-arm-kernel , Arnd Bergmann , LKML Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP On Wed, Apr 04, 2018 at 03:34:06PM -0700, Kees Cook wrote: > On Wed, Apr 4, 2018 at 5:30 AM, Arnd Bergmann wrote: > > gcc complains about fortify_panic() possibly returning: > > > > arch/arm/boot/compressed/misc.c: In function 'fortify_panic': > > arch/arm/boot/compressed/misc.c:167:1: error: 'noreturn' function does return [-Werror] > > > > This annotates the error() function as __noreturn, which lets gcc > > see in all configurations that it fortify_panic() cannot return either. > > > > Fixes: ee333554fed5 ("ARM: 8749/1: Kconfig: Add ARCH_HAS_FORTIFY_SOURCE") > > Signed-off-by: Arnd Bergmann > > Acked-by: Kees Cook I'd actually prefer a more robust solution to this - error() is used in different files, each with their own separate prototype, which is error-prone. The same goes for a few other variables. The following is IMHO a more complete (and thus larger) patch: arch/arm/boot/compressed/decompress.c | 5 +---- arch/arm/boot/compressed/misc.c | 2 +- arch/arm/boot/compressed/misc.h | 10 ++++++++++ 3 files changed, 12 insertions(+), 5 deletions(-) Acked-by: Arnd Bergmann diff --git a/arch/arm/boot/compressed/decompress.c b/arch/arm/boot/compressed/decompress.c index a2ac3fe7dbf8..c16c1829a5e4 100644 --- a/arch/arm/boot/compressed/decompress.c +++ b/arch/arm/boot/compressed/decompress.c @@ -6,10 +6,7 @@ #include /* for NULL */ #include #include - -extern unsigned long free_mem_ptr; -extern unsigned long free_mem_end_ptr; -extern void error(char *); +#include "misc.h" #define STATIC static #define STATIC_RW_DATA /* non-static please */ diff --git a/arch/arm/boot/compressed/misc.c b/arch/arm/boot/compressed/misc.c index a3ded2a64b32..e94c84dded6c 100644 --- a/arch/arm/boot/compressed/misc.c +++ b/arch/arm/boot/compressed/misc.c @@ -22,9 +22,9 @@ unsigned int __machine_arch_type; #include /* for inline */ #include #include +#include "misc.h" static void putstr(const char *ptr); -extern void error(char *x); #include CONFIG_UNCOMPRESS_INCLUDE diff --git a/arch/arm/boot/compressed/misc.h b/arch/arm/boot/compressed/misc.h new file mode 100644 index 000000000000..c958dccd1d97 --- /dev/null +++ b/arch/arm/boot/compressed/misc.h @@ -0,0 +1,10 @@ +#ifndef MISC_H +#define MISC_H + +#include + +void error(char *x) __noreturn; +extern unsigned long free_mem_ptr; +extern unsigned long free_mem_end_ptr; + +#endif