Commit bf2cbe04 authored by Nathan Chancellor's avatar Nathan Chancellor Committed by Steven Rostedt (VMware)

tracing: Use address-of operator on section symbols

Clang warns:

../kernel/trace/trace.c:9335:33: warning: array comparison always
evaluates to true [-Wtautological-compare]
        if (__stop___trace_bprintk_fmt != __start___trace_bprintk_fmt)
                                       ^
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 runtime result of the check (tested with some print
statements compiled in with clang + ld.lld and gcc + ld.bfd in QEMU).

Link: http://lkml.kernel.org/r/20200220051011.26113-1-natechancellor@gmail.com

Link: https://github.com/ClangBuiltLinux/linux/issues/893Suggested-by: default avatarNick Desaulniers <ndesaulniers@google.com>
Signed-off-by: default avatarNathan Chancellor <natechancellor@gmail.com>
Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
parent bbd9d056
...@@ -9334,7 +9334,7 @@ __init static int tracer_alloc_buffers(void) ...@@ -9334,7 +9334,7 @@ __init static int tracer_alloc_buffers(void)
goto out_free_buffer_mask; goto out_free_buffer_mask;
/* Only allocate trace_printk buffers if a trace_printk exists */ /* Only allocate trace_printk buffers if a trace_printk exists */
if (__stop___trace_bprintk_fmt != __start___trace_bprintk_fmt) if (&__stop___trace_bprintk_fmt != &__start___trace_bprintk_fmt)
/* Must be called before global_trace.buffer is allocated */ /* Must be called before global_trace.buffer is allocated */
trace_printk_init_buffers(); trace_printk_init_buffers();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment