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: <767d768e-70e5-4a94-accb-3384a3bfd582@app.fastmail.com>
Date:   Fri, 14 Oct 2022 10:10:39 +0200
From:   "Arnd Bergmann" <arnd@...db.de>
To:     "Nathan Chancellor" <nathan@...nel.org>,
        "Rob Herring" <robh+dt@...nel.org>,
        "Frank Rowand" <frowand.list@...il.com>
Cc:     devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
        "Matt Flax" <flatmax@...tmax.com>
Subject: Re: [PATCH] of: Define of_match_ptr() with PTR_IF() to avoid unused variable
 warnings

On Thu, Oct 13, 2022, at 9:51 PM, Nathan Chancellor wrote:
> 
> -#define of_match_ptr(_ptr)	NULL
>  #define of_match_node(_matches, _node)	NULL
>  #endif /* CONFIG_OF */
> 
> +#define of_match_ptr(_ptr)	PTR_IF(IS_ENABLED(CONFIG_OF), (_ptr))
> +

I think this is counterproductive, as it means we cannot use
of_match_ptr() for its intended purpose any more, it will
now cause a build failure for any driver that references a
match table inside of an #ifdef.

Ideally we should be able to find the misuse of this macro with
coccinelle and have it automatically generate patches that just remove
it from drivers.

A first-level approximation would be this oneliner:

git grep -wl of_match_ptr | xargs git grep -wL CONFIG_OF | xargs sed -i "s:of_match_ptr(\([\ \#\>\"a-zA-Z0-9_-]*\)):\1:"

which takes care of 535 files that don't reference CONFIG_OF at all.
There are 496 more files that use of_match_ptr() as well but also
guard something inside of CONFIG_OF. Most of these are just
incorrectly copy-pasted from older drivers and should not have an
#ifdef in them to make the of_match_ptr() work, but they are not actually
usable without CONFIG_OF.

Historically, we added the #ifdef at the time when we supported hundreds
of boards without DT and only a couple of boards with DT, so having the
extra #ifdef was a way of ensuring that the DT conversion would not add
a few extra bytes of .data to each driver. Now we support thousands of
boards with DT and only a few dozen without DT, so this is all pointless.

       Arnd

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ