mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jason Baron <jbaron@akamai.com>
To: Nathan Chancellor <natechancellor@gmail.com>
Cc: linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com,
	Nick Desaulniers <ndesaulniers@google.com>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH v2] dynamic_debug: Use address-of operator on section symbols
Date: Thu, 19 Mar 2020 16:03:39 -0400	[thread overview]
Message-ID: <4b766edb-73e2-c295-22eb-b501405baa9f@akamai.com> (raw)
In-Reply-To: <20200319015909.GA8292@ubuntu-m2-xlarge-x86>



On 3/18/20 9:59 PM, Nathan Chancellor wrote:
> On Wed, Feb 19, 2020 at 10:13:20PM -0700, Nathan Chancellor wrote:
>> 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@google.com>
>> Signed-off-by: Nathan Chancellor <natechancellor@gmail.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
>>
> 
> Gentle ping for review/acceptance.
> 
> Cheers,
> Nathan

Works for me.

Acked-by: Jason Baron <jbaron@akamai.com>

  reply	other threads:[~2020-03-19 20:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-20  5:13 Nathan Chancellor
2020-03-19  1:59 ` Nathan Chancellor
2020-03-19 20:03   ` Jason Baron [this message]
2020-03-19 21:43     ` Nathan Chancellor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4b766edb-73e2-c295-22eb-b501405baa9f@akamai.com \
    --to=jbaron@akamai.com \
    --cc=akpm@linux-foundation.org \
    --cc=clang-built-linux@googlegroups.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=natechancellor@gmail.com \
    --cc=ndesaulniers@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®