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] [day] [month] [year] [list]
Date:   Fri, 14 Oct 2022 09:47:43 -0700
From:   Nathan Chancellor <nathan@...nel.org>
To:     Arnd Bergmann <arnd@...db.de>
Cc:     Rob Herring <robh+dt@...nel.org>,
        Frank Rowand <frowand.list@...il.com>,
        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 Fri, Oct 14, 2022 at 10:10:39AM +0200, Arnd Bergmann wrote:
> 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.

Ack, I obviously had not considered this before sending the change,
shows how much compile testing it got ;)

> 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.

Ack to all of this but it sounds like this will be a bit of a larger
project than I am interested in picking up right now so consider this
patch retracted with an open invitation for someone else to continue
this clean up.

Cheers,
Nathan

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ