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: <AT5PR8401MB1169149078CDB1274A259703AB320@AT5PR8401MB1169.NAMPRD84.PROD.OUTLOOK.COM>
Date:   Wed, 8 May 2019 21:14:21 +0000
From:   "Elliott, Robert (Servers)" <elliott@....com>
To:     Antonio Borneo <borneo.antonio@...il.com>,
        Joe Perches <joe@...ches.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



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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ