From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 85558C55179 for ; Wed, 21 Oct 2020 16:51:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1AE5522384 for ; Wed, 21 Oct 2020 16:51:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2503183AbgJUQvD (ORCPT ); Wed, 21 Oct 2020 12:51:03 -0400 Received: from smtprelay0011.hostedemail.com ([216.40.44.11]:58960 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2444579AbgJUQvD (ORCPT ); Wed, 21 Oct 2020 12:51:03 -0400 Received: from filter.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay08.hostedemail.com (Postfix) with ESMTP id 13750182CED28; Wed, 21 Oct 2020 16:51:02 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-HE-Tag: ink53_4217b0127249 X-Filterd-Recvd-Size: 2566 Received: from XPS-9350.home (unknown [47.151.133.149]) (Authenticated sender: joe@perches.com) by omf14.hostedemail.com (Postfix) with ESMTPA; Wed, 21 Oct 2020 16:51:00 +0000 (UTC) Message-ID: <40ca3f0f9a960799ad0e534b77d778c90119e468.camel@perches.com> Subject: Re: [PATCH] checkpatch: fix false positive for REPEATED_WORD warning From: Joe Perches To: Aditya Srivastava Cc: linux-kernel@vger.kernel.org, lukas.bulwahn@gmail.com, linux-kernel-mentees@lists.linuxfoundation.org, dwaipayanray1@gmail.com Date: Wed, 21 Oct 2020 09:50:59 -0700 In-Reply-To: <26647abf8cf14595a0dd22f10ec1c32e3dc2a8c0.camel@perches.com> References: <20201021150120.29920-1-yashsri421@gmail.com> <26647abf8cf14595a0dd22f10ec1c32e3dc2a8c0.camel@perches.com> Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.36.4-0ubuntu1 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 2020-10-21 at 08:28 -0700, Joe Perches wrote: > On Wed, 2020-10-21 at 08:18 -0700, Joe Perches wrote: > > I might add that check to the line below where > > the repeated words are checked against long > [] > > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl > [] > > @@ -3062,6 +3062,7 @@ sub process { > > > > next if ($first ne $second); > > next if ($first eq 'long'); > > + next if ($first =~ /^$Hex$/; > > oops. with a close parenthesis added of course... That doesn't work as $Hex expects a leading 0x. But this does... The negative of this approach is it would also not emit a warning on these repeated words: (doesn't seem too bad) $ grep -P '^[0-9a-f]{2,}$' /usr/share/dict/words abed accede acceded ace aced ad add added baa baaed babe bad bade be bead beaded bed bedded bee beef beefed cab cabbed cad cede ceded dab dabbed dad dead deaf deb decade decaf deed deeded deface defaced ebb ebbed efface effaced fa facade face faced fad fade faded fed fee feed --- scripts/checkpatch.pl | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index fab38b493cef..79d7a4cba19e 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -3062,6 +3062,7 @@ sub process { next if ($first ne $second); next if ($first eq 'long'); + next if ($first =~ /^[0-9a-f]+$/i); if (WARN("REPEATED_WORD", "Possible repeated word: '$first'\n" . $herecurr) &&