]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
sh: mark end of BUG() implementation as unreachable
authorKees Cook <keescook@chromium.org>
Wed, 12 Jul 2017 21:36:13 +0000 (14:36 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 12 Jul 2017 23:26:03 +0000 (16:26 -0700)
When building the sh architecture, the compiler doesn't realize that
BUG() doesn't return, so it will complain about functions using BUG()
that are marked with the noreturn attribute:

   lib/string.c: In function 'fortify_panic':
>> lib/string.c:986:1: warning: 'noreturn' function does return
    }
    ^

Link: http://lkml.kernel.org/r/20170627192050.GA66784@beast
Signed-off-by: Kees Cook <keescook@chromium.org>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: Rich Felker <dalias@libc.org>
Cc: Daniel Micay <danielmicay@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
arch/sh/include/asm/bug.h

index 1b77f068be2b1d027ae460ce0e6919a84223a1f1..c9828f785ca0bce1f3e49a73def335bfc67eafc7 100644 (file)
@@ -48,6 +48,7 @@ do {                                                  \
                   "i" (__FILE__),                      \
                   "i" (__LINE__), "i" (0),             \
                   "i" (sizeof(struct bug_entry)));     \
+       unreachable();                                  \
 } while (0)
 
 #define __WARN_FLAGS(flags)                            \