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: <2b966f46a5f60de629681527bb00401830118947.camel@perches.com>
Date:   Tue, 11 Apr 2023 18:53:42 -0700
From:   Joe Perches <joe@...ches.com>
To:     Andy Shevchenko <andy@...nel.org>,
        Björn Töpel <bjorn@...nel.org>
Cc:     Andy Whitcroft <apw@...onical.com>,
        Dwaipayan Ray <dwaipayanray1@...il.com>,
        Lukas Bulwahn <lukas.bulwahn@...il.com>,
        linux-kernel@...r.kernel.org,
        Björn Töpel <bjorn@...osinc.com>
Subject: Re: [RFC PATCH] checkpatch: Support __initconst combined with
 struct definition

On Tue, 2023-04-11 at 16:38 +0300, Andy Shevchenko wrote:
> On Wed, Mar 01, 2023 at 10:43:20AM +0100, Björn Töpel wrote:
> > From: Björn Töpel <bjorn@...osinc.com>
> > 
> > Checkpatch sometimes report a false positive for __initconst. E.g., for the
> > following snippet:
> > 
> >  | static const struct strspn_test {
> >  | 	const char str[16];
> >  | 	const char accept[16];
> >  | 	const char reject[16];
> >  | 	unsigned a;
> >  | 	unsigned r;
> >  | } tests[] __initconst = {
> >  | 	{ "foobar", "", "", 0, 6 },
> >  | 	{ "abba", "abc", "ABBA", 4, 4 },
> >  | 	{ "abba", "a", "b", 1, 1 },
> >  | 	{ "", "abc", "abc", 0, 0},
> >  | };
> > 
> > checkpatch would report:
> > 
> >  | ERROR: Use of __initconst requires a separate use of const
> >  | #190: FILE: ./test_string.c:190:
> >  | +	} tests[] __initconst = {
> > 
> > Improve the reporting by trying harder to find the 'const'.
> 
> Joe, what do you think about this?

I think the ctx_block_outer_rev  function doesn't handle patch
context blocks and the loop at best needs to be changed to include

	last if $rawlines[$line] =~ /^@/);.

And the loop parsing couldn't handle structs with embedded
unions or structs.

I also think that checkpatch will always have false negatives
and false positives and this might not be that useful as likely
most compilers should now be able to identify this as well.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ