]> Git Repo - linux.git/commitdiff
lib/dynamic_debug.c: use address-of operator on section symbols
authorNathan Chancellor <[email protected]>
Tue, 7 Apr 2020 03:10:45 +0000 (20:10 -0700)
committerLinus Torvalds <[email protected]>
Tue, 7 Apr 2020 17:43:43 +0000 (10:43 -0700)
Clang warns:

../lib/dynamic_debug.c:1034:24: warning: array comparison always
evaluates to false [-Wtautological-compare]
        if (__start___verbose == __stop___verbose) {
                              ^
1 warning generated.

These are not true arrays, they are linker defined symbols, which are just
addresses.  Using the address of operator silences the warning and does
not change the resulting assembly with either clang/ld.lld or gcc/ld
(tested with diff + objdump -Dr).

Suggested-by: Nick Desaulniers <[email protected]>
Signed-off-by: Nathan Chancellor <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Acked-by: Jason Baron <[email protected]>
Link: https://github.com/ClangBuiltLinux/linux/issues/894
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Linus Torvalds <[email protected]>
lib/dynamic_debug.c

index aae17d9522e5e0a8265daab1870b7cfeffb54b7e..8f199f403ab50656c4d91344932204bee6ac9d17 100644 (file)
@@ -1031,7 +1031,7 @@ static int __init dynamic_debug_init(void)
        int n = 0, entries = 0, modct = 0;
        int verbose_bytes = 0;
 
-       if (__start___verbose == __stop___verbose) {
+       if (&__start___verbose == &__stop___verbose) {
                pr_warn("_ddebug table is empty in a CONFIG_DYNAMIC_DEBUG build\n");
                return 1;
        }
This page took 0.057645 seconds and 4 git commands to generate.