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]
Date:   Tue, 29 Nov 2022 12:24:56 -0600
From:   Andrew Davis <afd@...com>
To:     Masahiro Yamada <masahiroy@...nel.org>
CC:     Alexander Lobakin <alobakin@...me>, <linux-kbuild@...r.kernel.org>,
        Nicolas Schier <nicolas@...sle.eu>,
        Jens Axboe <axboe@...nel.dk>,
        "Boris Brezillon" <bbrezillon@...nel.org>,
        Borislav Petkov <bp@...en8.de>,
        Tony Luck <tony.luck@...el.com>,
        Miquel Raynal <miquel.raynal@...tlin.com>,
        "Vladimir Oltean" <vladimir.oltean@....com>,
        Alexandre Belloni <alexandre.belloni@...tlin.com>,
        Derek Chickles <dchickles@...vell.com>,
        Ioana Ciornei <ioana.ciornei@....com>,
        Salil Mehta <salil.mehta@...wei.com>,
        Sunil Goutham <sgoutham@...vell.com>,
        Grygorii Strashko <grygorii.strashko@...com>,
        Daniel Scally <djrscally@...il.com>,
        "Hans de Goede" <hdegoede@...hat.com>,
        Mark Brown <broonie@...nel.org>,
        Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
        NXP Linux Team <linux-imx@....com>, <netdev@...r.kernel.org>,
        <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 01/18] block/rnbd: fix mixed module-builtin object

On 11/21/22 11:59 PM, Masahiro Yamada wrote:
> On Tue, Nov 22, 2022 at 6:18 AM Andrew Davis <afd@...com> wrote:
>>
>> On 11/19/22 5:04 PM, Alexander Lobakin wrote:
>>> From: Masahiro Yamada <masahiroy@...nel.org>
>>>
>>> With CONFIG_BLK_DEV_RNBD_CLIENT=m and CONFIG_BLK_DEV_RNBD_SERVER=y
>>> (or vice versa), rnbd-common.o is linked to a module and also to
>>> vmlinux even though CFLAGS are different between builtins and modules.
>>>
>>> This is the same situation as fixed by commit 637a642f5ca5 ("zstd:
>>> Fixing mixed module-builtin objects").
>>>
>>> Turn rnbd_access_mode_str() into an inline function.
>>>
>>
>> Why inline? All you should need is "static" to keep these internal to
>> each compilation unit. Inline also bloats the object files when the
>> function is called from multiple places. Let the compiler decide when
>> to inline.
>>
>> Andrew
> 
> 
> Since it is a header file.
> 
> 
> In header files, "static inline" should be always used.
> Never "static".
> 

My comment was more "why"?

> 
> If a header is included from a C file and there is a function
> that is not used from that C file,
> "static" would emit -Wunused-function warning
> (-Wunused-function is enabled by -Wall, which is the case
> for the kernel build).
> 
> 

Inline still hints to the compiler to inline, causing unneeded
object size bloat. Using "inline" to signal something else (that
the function may be unused) when we already have a flag for that
(__maybe_unused) feels wrong.

Seems this was already debated way back in 2006.. So maybe not
worth revisiting today, but still a cleanup that could be good
to think more about later.

Andrew

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ