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: <CAGXu5jJmp4-sposMxjTobEj0xzueQY54OzvdDQg-GC-HhJuBwQ@mail.gmail.com>
Date:	Thu, 21 Aug 2014 18:01:08 -0500
From:	Kees Cook <keescook@...omium.org>
To:	Joe Perches <joe@...ches.com>
Cc:	LKML <linux-kernel@...r.kernel.org>,
	Andy Whitcroft <apw@...onical.com>,
	Andrew Morton <akpm@...ux-foundation.org>,
	"David S. Miller" <davem@...emloft.net>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Mauro Carvalho Chehab <m.chehab@...sung.com>,
	Antti Palosaari <crope@....fi>
Subject: Re: [PATCH] checkpatch: look for common misspellings

On Thu, Aug 21, 2014 at 12:18 PM, Joe Perches <joe@...ches.com> wrote:
> On Thu, 2014-08-21 at 09:20 -0700, Kees Cook wrote:
>> Check for misspellings, based on Debian's lintian list. Several false
>> positives were removed, and several additional words added that were
>> common in the kernel:
> []
>> diff --git a/MAINTAINERS b/MAINTAINERS
> []
>> @@ -2311,6 +2311,7 @@ M:      Andy Whitcroft <apw@...onical.com>
>>  M:   Joe Perches <joe@...ches.com>
>>  S:   Maintained
>>  F:   scripts/checkpatch.pl
>> +F:   scripts/spelling.txt
>
> I don't want to be responsible for misspellings.
>
> Maybe this should be moved to another section
> and you could be added as a maintainer for that.

Okay, sure. Happy to do so. Or maybe some -docs folks want to join me? :)

>
>> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> []
>> +# Check for several spelling mistakes.
>> +             if ($rawline =~ $spelling_re) {
>
> $spelling_re has a rather hidden ( ... ) use so I think
> it'd be better to not use spelling_re at all and have a
> variable like:
> our $misspellings = join('|', @spelling_list);
>
> and also use while so all misspellings are found so this
> could be:
>
>                 while ($rawline =~ /(?:^|$edge)($misspellings)(?:\$|$edge)/g) {
>
>> +                     my $typo = "The word '$1' may be misspelled";
>> +                     $typo .= " (perhaps you want '$spelling_fix{$1}'?)\n";
>> +                     WARN("TYPO_SPELLING", $typo . $herecurr);
>> +             }
>>       }
>
> Seems sensible, but this checks only .c and .h files.
> Any of the Kconfig/.txt files are skipped.

Oh, hm. Yes, seems like this should be relocated then.

> I'd probably leave out "The word "

Fair enough.

> Maybe add a $fix too?
>
> Maybe:
>
>                 while ($rawline =~ /(?:^|$edge)($misspellings)(?:\$|$edge)/g) {
>                         my $typo = $1;
>                         if (WARN("TYPO_SPELLING",
>                                  "$typo may be misspelled - Use '$spelling_fix($typo)'?\n" . $herecurr) &&
>                             $fix) {
>                                 $fixed[$fixlinenr] =~ s/(?:^|$edge)($typo)(?:\$|$edge)/$spelling_fix($typo)/;
>                         }
>                 }
>
>

Cool, let me grok your suggested patch and reply. Thanks for looking this over!

-Kees

-- 
Kees Cook
Chrome OS Security
--
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