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  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]
Date:   Sat, 26 Dec 2020 07:50:04 -0800
From:   Joe Perches <joe@...ches.com>
To:     Nicolai Fischer <nicolai.fischer@....de>,
        linux-kernel@...r.kernel.org
Cc:     apw@...onical.com, johannes.czekay@....de,
        linux-kernel@...cs.fau.de, akpm@...ux-foundation.org
Subject: Re: [PATCH v2 3/4] checkpatch: kconfig: enforce help text
 indentation

On Sat, 2020-12-26 at 15:05 +0100, Nicolai Fischer wrote:
> Adds a new warning in case the indentation level of the
> first line of a Kconfig help message is not two spaces
> higher than the keyword itself.
> Blank lines between the message and the help keyword
> are ignored.
[]
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
[]
> @@ -3332,6 +3336,13 @@ sub process {
>  				$f =~ s/^\s+//;
>  				next if ($f =~ /^$/);
>  
> 
> +				if (defined $help_indent) {
> +					if ($lines[$ln - 1] !~ /^\+$help_indent\ {2}\S*/) {
> +						$help_stat_real = get_stat_real($ln - 1, $ln);
> +					}
> +					undef $help_indent;
> +				}

This doesn't work if the indent is more than 2 spaces.

$ cat Kconfigtest
menuconfig FOO
	bool "Enable foo" if EXPERT
	default y
	help
	   Line 1.
	   Line 2.
	   Line 3.
	   Line 4.

$ ./scripts/checkpatch.pl -f Kconfigtest
total: 0 errors, 0 warnings, 10 lines checked

Kconfigtest has no obvious style problems and is ready for submission.

Also, it may be useful to test that the indent after a block
uses a single tab more than the block start.

Look at the first block of block/Kconfig:

The indentation of bool and help uses 7 spaces but the indentation
of the help text uses a tab then 1 space.

It'd be useful to emit a warning for that.

menuconfig BLOCK
       bool "Enable the block layer" if EXPERT
       default y
       select SBITMAP
       select SRCU
       help
	 Provide block layer support for the kernel.

	 Disable this option to remove the block layer support from the
	 kernel. This may be useful for embedded devices.

	 If this option is disabled:

	   - block device files will become unusable
	   - some filesystems (such as ext3) will become unavailable.

	 Also, SCSI character devices and USB storage will be disabled since
	 they make use of various block layer definitions and facilities.

	 Say Y here unless you know you really don't want to mount disks and
	 suchlike.


Powered by blists - more mailing lists