lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <153989459788.53599.2276628850158968119@swboyd.mtv.corp.google.com>
Date:   Thu, 18 Oct 2018 13:29:57 -0700
From:   Stephen Boyd <sboyd@...nel.org>
To:     Bartlomiej Zolnierkiewicz <b.zolnierkie@...sung.com>,
        Krzysztof Kozlowski <krzk@...nel.org>,
        Michael Turquette <mturquette@...libre.com>,
        Nathan Chancellor <natechancellor@...il.com>,
        Sangbeom Kim <sbkim73@...sung.com>
Cc:     linux-kernel@...r.kernel.org, linux-samsung-soc@...r.kernel.org,
        linux-clk@...r.kernel.org,
        Nick Desaulniers <ndesaulniers@...gle.com>,
        Nathan Chancellor <natechancellor@...il.com>
Subject: Re: [PATCH] clk: s2mps11: Add used attribute to s2mps11_dt_match

Quoting Nathan Chancellor (2018-10-18 12:13:40)
> Clang warns after commit 8985167ecf57 ("clk: s2mps11: Fix matching when
> built as module and DT node contains compatible"):
> 
> drivers/clk/clk-s2mps11.c:242:34: warning: variable 's2mps11_dt_match'
> is not needed and will not be emitted [-Wunneeded-internal-declaration]
> static const struct of_device_id s2mps11_dt_match[] = {
>                                  ^
> 1 warning generated.
> 
> This warning happens when a variable is used in some construct that
> doesn't require a reference to that variable to be emitted in the symbol
> table; in this case, it's MODULE_DEVICE_TABLE, which only needs to hold
> the data of the variable, not the variable itself.
> 
> $ nm -S drivers/clk/clk-s2mps11.o | rg s2mps11_dt_match
> 00000078 000003d4 R __mod_of__s2mps11_dt_match_device_table
> 
> Normally, with device ID table variables, it means that the variable
> just needs to be tied to the device declaration at the bottom of the
> file, like s2mps11_clk_id:
> 
> $ nm -S drivers/clk/clk-s2mps11.o | rg s2mps11_clk_id
> 00000000 00000078 R __mod_platform__s2mps11_clk_id_device_table
> 00000000 00000078 r s2mps11_clk_id
> 
> However, because the comment above this deliberately doesn't want this
> variable added to .of_match_table, we need to mark s2mps11_dt_match as
> __used to silence this warning. This makes it clear to Clang that the
> variable is used for something, even if a reference to it isn't being
> emitted.
> 
> Signed-off-by: Nathan Chancellor <natechancellor@...il.com>
> ---

Just curious if this is a common occurrence? Maybe we should make a new
MODULE_DEVICE_TABLE macro that can declare the table, struct type, and
add in __used to the declaration like is done here? That way this gotcha
goes away without us having to remember that the table is used or not
used somewhere.

Anyway, I'll apply this patch to clk-next.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ