arm: decompressor: mark error() as __noreturn
PATCH 1/1 arm: decompressor: mark error() as __noreturn
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.
--- arch/arm/boot/compressed/misc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/compressed/misc.c +1 -1
@@ -24,7 +24,7 @@ unsigned int __machine_arch_type;#include <linux/linkage.h> static void putstr (const char *ptr); -extern void error (char *x); +extern void error (char *x)__noreturn ;#include CONFIG_UNCOMPRESS_INCLUDE
Signature · 1 line
2.9.0
Quoted 10 lines · Arnd Bergmann
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 itfortify_panic()cannot return either.Fixes ee333554fed5 ("ARM: 8749/1: Kconfig: Add ARCH_HAS_FORTIFY_SOURCE")Signed-off-by Arnd Bergmann <[email protected]>
-Kees
Quoted 20 lines
--- arch/arm/boot/compressed/misc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/arm/boot/compressed/misc.c +1
-2@@ -24,7 +24,7 @@ unsigned int __machine_arch_type;#include <linux/linkage.h> static void putstr (const char *ptr); -extern void error (char *x); +extern void error (char *x)__noreturn ;#include CONFIG_UNCOMPRESS_INCLUDE --2.9.0
Signature · 2 lines
Kees Cook Pixel Security
Russell King - ARM Linux
maintainerQuoted 6 lines · Kees Cook
Quoted 5 lines · Arnd Bergmann
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]
Quoted 7 lines
Quoted 5 lines
This annotates the
error()function as__noreturn, which lets gcc see in all configurations that itfortify_panic()cannot return either.Fixes ee333554fed5 ("ARM: 8749/1: Kconfig: Add ARCH_HAS_FORTIFY_SOURCE")Signed-off-by Arnd Bergmann <[email protected]>Acked-by Kees Cook <[email protected]>
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(-)
arch/arm/boot/compressed/decompress.c +1 -4
@@ -6,10 +6,7 @@#include <linux/stddef.h> /* for NULL */ #include <linux/linkage.h> #include <asm/string.h> - -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 */
arch/arm/boot/compressed/misc.c +1 -1
@@ -22,9 +22,9 @@ unsigned int __machine_arch_type;#include <linux/compiler.h> /* for inline */ #include <linux/types.h> #include <linux/linkage.h> +#include "misc.h" static void putstr (const char *ptr); -extern void error (char *x);#include CONFIG_UNCOMPRESS_INCLUDE
arch/arm/boot/compressed/misc.h new file +10 -0
@@ -0,0 +1,10 @@ +#ifndef MISC_H +#define MISC_H + +#include <linux/compiler.h> + +void error (char *x)__noreturn ; +extern unsigned long free_mem_ptr; +extern unsigned long free_mem_end_ptr; + +#endif
Signature · 3 lines
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/ FTTC broadband for 0.8mile line in suburbia: sync at 8.8Mbps down 630kbps up According to speedtest.net: 8.21Mbps down 510kbps up
Arnd Bergmann
Acked-byQuoted 13 lines · Russell King - ARM Linux
Quoted 12 lines · Kees Cook
Quoted 10 lines · Arnd Bergmann
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 itfortify_panic()cannot return either.Fixes ee333554fed5 ("ARM: 8749/1: Kconfig: Add ARCH_HAS_FORTIFY_SOURCE")Signed-off-by Arnd Bergmann <[email protected]>
Quoted 6 lines
Quoted 1 line
Acked-by Kees Cook <[email protected]>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:
Right, much better.
I assume you'll just fold it into the original patch if you can, or apply it on top yourself.