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]
Message-ID: <d3cf5de00a7ac017ae70d4cba58c1d93defd5491.camel@perches.com>
Date:   Wed, 30 Jun 2021 10:33:23 -0700
From:   Joe Perches <joe@...ches.com>
To:     jim.cromie@...il.com
Cc:     LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 2/3] checkpatch: tweak extern in C warning

On Sat, 2021-06-26 at 21:47 -0600, jim.cromie@...il.com wrote:
> On Sat, Jun 26, 2021 at 12:46 PM Joe Perches <joe@...ches.com> wrote:
> > On Fri, 2021-06-25 at 21:40 -0600, Jim Cromie wrote:
> > > The extern-in-C rule has one important exception: the symbol is
> > > defined in/by the linker script.  By convention, these almost always
> > > contain: _start, _stop, _end.  Suppress the warning on such symbols.
> > []
> > > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> > > []
> > > @@ -6910,7 +6910,8 @@ sub process {
> > >                   $stat =~ /^.\s*extern\s+/)
> > >               {
> > >                       WARN("AVOID_EXTERNS",
> > > -                          "externs should be avoided in .c files\n" .  $herecurr);
> > > +                          "externs should be avoided in .c files\n($stat)\n" .  $herecurr)
> > > +                         unless $stat =~ /_start|_stop|_end/;
> > 
> > nak.
> > 
> > As far as I can tell, there's no reason these symbols
> > should not be in .h files.
> 
> judging from the codebase, it has been a case-by-case decision,
> with 8/10 of the linker-vars extern'd into C files, not headers.
[]
> > besides that:
> > 
> > output is single line, $stat should not be used and
> > using unless is not desired.
> > 
> 
> could you clarify ?
> style issues are easy, std if form...
> $stat is already used, it must contain extern to get here.

Sure, it's used as part of a test but it's never output as part of
an error message.  $stat strips any leading '+' from the 2nd and
subsequent lines.

There's a mechanism used in several other tests to show these lines.

				my $cnt = statement_rawlines($stat);
				my $herectx = get_stat_here($linenr, $cnt, $here);

with the output of $herectx.

> checking it for a likely-linker-symbol seems fair.


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ