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 19C0EC388F7 for ; Thu, 22 Oct 2020 19:33:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AD5E4241A4 for ; Thu, 22 Oct 2020 19:33:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S370327AbgJVTdI (ORCPT ); Thu, 22 Oct 2020 15:33:08 -0400 Received: from smtprelay0036.hostedemail.com ([216.40.44.36]:48060 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S370319AbgJVTdI (ORCPT ); Thu, 22 Oct 2020 15:33:08 -0400 Received: from filter.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay01.hostedemail.com (Postfix) with ESMTP id DE7C2100E7B43; Thu, 22 Oct 2020 19:33:06 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-HE-Tag: lake06_0c0514e27253 X-Filterd-Recvd-Size: 2520 Received: from XPS-9350.home (unknown [47.151.133.149]) (Authenticated sender: joe@perches.com) by omf06.hostedemail.com (Postfix) with ESMTPA; Thu, 22 Oct 2020 19:33:05 +0000 (UTC) Message-ID: <67247b2d51aa8b2da7377e400e9191733144ed0f.camel@perches.com> Subject: Re: [PATCH v2] checkpatch: fix false positives in REPEATED_WORD warning From: Joe Perches To: Aditya Cc: linux-kernel@vger.kernel.org, linux-kernel-mentees@lists.linuxfoundation.org, lukas.bulwahn@gmail.com, dwaipayanray1@gmail.com Date: Thu, 22 Oct 2020 12:33:04 -0700 In-Reply-To: <5121bf7c-a126-6178-62ff-e54f0bb4cb6e@gmail.com> References: <20201022145021.28211-1-yashsri421@gmail.com> <4cbbd8d8b6c4d686f71648af8bc970baa4b0ee9b.camel@perches.com> <5121bf7c-a126-6178-62ff-e54f0bb4cb6e@gmail.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 Fri, 2020-10-23 at 00:44 +0530, Aditya wrote: > On 22/10/20 9:40 pm, Joe Perches wrote: > > On Thu, 2020-10-22 at 20:20 +0530, Aditya Srivastava wrote: > > > Presence of hexadecimal address or symbol results in false warning > > > message by checkpatch.pl. > > [] > > > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl > > [] > > > @@ -3051,7 +3051,10 @@ sub process { > > > } > > > > > > # check for repeated words separated by a single space > > > - if ($rawline =~ /^\+/ || $in_commit_log) { > > > +# avoid false positive from list command eg, '-rw-r--r-- 1 root root' > > > + if (($rawline =~ /^\+/ || $in_commit_log) && > > > + $rawline !~ /[bcCdDlMnpPs\?-][rwxsStT-]{9}/) { > > > > Alignment and use \b before and after the regex please. > > If we use \b either before or after or both it does not match patterns > such as: > + -rw-r--r--. 1 root root 112K Mar 20 12:16' selinux-policy-3.14.4-48.fc31.noarch.rpm OK, thanks, it's good you checked. > > [] > > What does all this code actually avoid? > > Sir, there are multiple variations of hex for which this warning is > occurring, for eg: > 1) 00 c0 06 16 00 00 ff ff 00 93 1c 18 00 00 ff ff ................ > 2) ffffffff ffffffff 00000000 c070058c > 3) f5a: 48 c7 44 24 78 ff ff movq > $0xffffffffffffffff,0x78(%rsp) > 4) + fe fe > 5) + fe fe - ? end marker ? > 6) Code: ff ff 48 (...) So why not just match first with /^[0-9a-f]+$/i ? Doesn't that match all the cases listed above?