bpf: btf: avoid -Wreturn-type warning
authorArnd Bergmann <arnd@arndb.de>
Fri, 25 May 2018 21:33:19 +0000 (23:33 +0200)
committerDaniel Borkmann <daniel@iogearbox.net>
Mon, 28 May 2018 15:40:58 +0000 (17:40 +0200)
gcc warns about a noreturn function possibly returning in
some configurations:

kernel/bpf/btf.c: In function 'env_type_is_resolve_sink':
kernel/bpf/btf.c:729:1: error: control reaches end of non-void function [-Werror=return-type]

Using BUG() instead of BUG_ON() avoids that warning and otherwise
does the exact same thing.

Fixes: eb3f595dab40 ("bpf: btf: Validate type reference")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Song Liu <songliubraving@fb.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
kernel/bpf/btf.c

index 7e90fd13b5b55b0e9e92bc38a00a7a517e6021a6..3d20aa1f4b543194a34724f193ae8f78df016222 100644 (file)
@@ -749,7 +749,7 @@ static bool env_type_is_resolve_sink(const struct btf_verifier_env *env,
                        !btf_type_is_array(next_type) &&
                        !btf_type_is_struct(next_type);
        default:
-               BUG_ON(1);
+               BUG();
        }
 }