[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200220051320.10739-1-natechancellor@gmail.com>
Date: Wed, 19 Feb 2020 22:13:20 -0700
From: Nathan Chancellor <natechancellor@...il.com>
To: Jason Baron <jbaron@...mai.com>
Cc: linux-kernel@...r.kernel.org, clang-built-linux@...glegroups.com,
Nathan Chancellor <natechancellor@...il.com>,
Nick Desaulniers <ndesaulniers@...gle.com>
Subject: [PATCH v2] dynamic_debug: Use address-of operator on section symbols
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).
Link: https://github.com/ClangBuiltLinux/linux/issues/894
Suggested-by: Nick Desaulniers <ndesaulniers@...gle.com>
Signed-off-by: Nathan Chancellor <natechancellor@...il.com>
---
v1 -> v2: https://lore.kernel.org/lkml/20200219045423.54190-5-natechancellor@gmail.com/
* No longer a series because there is no prerequisite patch.
* Use address-of operator instead of casting to unsigned long.
lib/dynamic_debug.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c
index aae17d9522e5..8f199f403ab5 100644
--- a/lib/dynamic_debug.c
+++ b/lib/dynamic_debug.c
@@ -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;
}
--
2.25.1
Powered by blists - more mailing lists