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: <4ce8826150026abd7649acb7b9fc143a033b7720.camel@perches.com>
Date:   Wed, 08 May 2019 14:59:48 -0700
From:   Joe Perches <joe@...ches.com>
To:     "Elliott, Robert (Servers)" <elliott@....com>,
        Antonio Borneo <borneo.antonio@...il.com>,
        Andy Whitcroft <apw@...onical.com>
Cc:     "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2] checkpatch: add command-line option for TAB size

On Wed, 2019-05-08 at 21:14 +0000, Elliott, Robert (Servers) wrote:
> > -----Original Message-----
> > From: linux-kernel-owner@...r.kernel.org [mailto:linux-kernel-owner@...r.kernel.org] On Behalf Of
> > Antonio Borneo
> > Sent: Wednesday, May 8, 2019 12:44 PM
> > Subject: [PATCH v2] checkpatch: add command-line option for TAB size
> ...
> > Add a command-line option "--tab-size" to let the user select a
> > TAB size value other than 8.
> > This makes easy to reuse this script by other projects with
> > different requirements in their coding style (e.g. OpenOCD [1]
> > requires TAB size of 4 characters [2]).
> ...
> > +  --tab-size=n               set the number of spaces for tab (default 8)
> ...
> > +	'tab-size=i'	=> \$tabsize,
> ...
> > -			for (; ($n % 8) != 0; $n++) {
> > +			for (; ($n % $tabsize) != 0; $n++) {
> ...
> > -			if ($indent % 8) {
> > +			if ($indent % $tabsize) {
> > -					"\t" x ($pos / 8) .
> > -					" "  x ($pos % 8);
> > +					"\t" x ($pos / $tabsize) .
> > +					" "  x ($pos % $tabsize);
> ...
> > -			    (($sindent % 8) != 0 ||
> > +			    (($sindent % $tabsize) != 0 ||
> ...
> > -			     ($sindent > $indent + 8))) {
> > +			     ($sindent > $indent + $tabsize))) {
> 
> Checking for 0 before using the value in division and modulo
> operations would be prudent.

true.

Maybe test $tabsize for <= 0 after GetOptions and error out
if so.


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ