[PATCH] x86/boot: Correctly deeclare error() as noreturn

From: Kees Cook
Date: Sat May 06 2017 - 00:51:30 EST

The compressed boot function error() is used to halt execution, but it
wasn't marked with "noreturn". This fixes that in preparation for
supporting kernel FORTIFY_SOURCE, which uses the noreturn annotation
on panic, and calls error(). GCC would warn about a noreturn function
calling a non-noreturn function:

arch/x86/boot/compressed/misc.c: In function âfortify_panicâ:
arch/x86/boot/compressed/misc.c:416:1: warning: ânoreturnâ function does return

Cc: Daniel Micay <danielmicay@xxxxxxxxx>
Signed-off-by: Kees Cook <keescook@xxxxxxxxxxxx>
arch/x86/boot/compressed/error.h | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/x86/boot/compressed/error.h b/arch/x86/boot/compressed/error.h
index 2e59dac07f9e..d732e608e3af 100644
--- a/arch/x86/boot/compressed/error.h
+++ b/arch/x86/boot/compressed/error.h
@@ -1,7 +1,9 @@

+#include <linux/compiler.h>
void warn(char *m);
-void error(char *m);
+void error(char *m) __noreturn;


Kees Cook
Pixel Security