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, 10 Sep 2010 02:30:37 -0700
From:	Joe Perches <joe@...ches.com>
To:	Andy Whitcroft <apw@...onical.com>
Cc:	Mike Frysinger <vapier.adi@...il.com>,
	LKML <linux-kernel@...r.kernel.org>,
	Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH] scripts/checkpatch.pl: Add warnings for static char
 that could be static const char

On Fri, 2010-09-10 at 10:06 +0100, Andy Whitcroft wrote:
> On Thu, Sep 09, 2010 at 03:24:14PM -0400, Mike Frysinger wrote:
> > On Thu, Sep 9, 2010 at 15:21, Joe Perches wrote:
> > > Add warnings for possible missing const uses of
> > >        static char foo[] = "bar"
> > >    that could be
> > >        static const char foo[] = "bar"
> > > and
> > >        static const char *foo[] = {"bar", "baz"}
> > >    that could be
> > >        static const char * const foo[] = {"bar", "baz"}
> > guess you missed my last e-mail about not bothering checking the
> > static or the contents :)
> > > +               if ($line =~ /\bconst\s+char\s*\*\s*(\w+)\s*\[\s*\]/) {
> > -mike
> Could you elucidate on that comment Mike, perhaps copy those comments
> here.

Mike thinks that any time there is a char array declaration
with a default value like
	[static] char foo[] = "bar";
or
	[static] [const] char *foo[] = {"bar", ...};

checkpatch should issue a "use const" warning.

http://lkml.org/lkml/2010/9/9/205

Maybe.  Maybe not.  I don't like unnecessary warnings for
functional code.  I think it depends on how often those
initialized strings are actually modified post declaration.

If it's a _really_ high percentage, then OK, sure.


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ