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-next>] [day] [month] [year] [list]
Date:   Wed,  8 Feb 2017 16:05:01 -0800
From:   Brian Norris <briannorris@...omium.org>
To:     Andy Whitcroft <apw@...onical.com>, Joe Perches <joe@...ches.com>
Cc:     <linux-kernel@...r.kernel.org>,
        Brian Norris <briannorris@...omium.org>
Subject: [PATCH] checkpatch: don't complain on module_param(foo, bar, 0)

The following code snippet:

    module_param(writeable, bool, 0);

yields this warning:

    ERROR: Use 4 digit octal (0777) not decimal permissions
    #390: FILE: drivers/mtd/spi-nor/intel-spi.c:143:
    +module_param(writeable, bool, 0);
    total: 1 errors, 0 warnings, 1006 lines checked

But 0000 is no easier to read than 0, and module_param() even
specifically refers to 0.

You can, for instance, test the patch:

    [PATCH v6 1/3] spi-nor: Add support for Intel SPI serial flash controller

like this:

    $ wget -qO - https://patchwork.ozlabs.org/patch/699946/mbox/ | scripts/checkpatch.pl -

Signed-off-by: Brian Norris <briannorris@...omium.org>
---
 scripts/checkpatch.pl | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 982c52ca6473..ada28aad8d64 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -6138,6 +6138,10 @@ sub process {
 				if ($stat =~ /$test/) {
 					my $val = $1;
 					$val = $6 if ($skip_args ne "");
+					# '0' is valid; some APIs special-case
+					# '0' as "no sysfs" node, and it's no
+					# harder to read than '0000'.
+					next if ($val eq "0");
 					if (($val =~ /^$Int$/ && $val !~ /^$Octal$/) ||
 					    ($val =~ /^$Octal$/ && length($val) ne 4)) {
 						ERROR("NON_OCTAL_PERMISSIONS",
-- 
2.11.0.483.g087da7b7c-goog

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ