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: <c5e4479d-2fb3-b5a5-00c3-b06e5177d869@linux.com>
Date:   Sat, 31 Aug 2019 20:07:34 +0300
From:   Denis Efremov <efremov@...ux.com>
To:     Markus Elfring <Markus.Elfring@....de>,
        Joe Perches <joe@...ches.com>
Cc:     Andrew Morton <akpm@...ux-foundation.org>,
        Anton Altaparmakov <anton@...era.com>,
        Andy Whitcroft <apw@...onical.com>,
        Boris Ostrovsky <boris.ostrovsky@...cle.com>,
        Boris Pismenny <borisp@...lanox.com>,
        "Darrick J. Wong" <darrick.wong@...cle.com>,
        "David S. Miller" <davem@...emloft.net>,
        Dennis Dalessandro <dennis.dalessandro@...el.com>,
        Dmitry Torokhov <dmitry.torokhov@...il.com>,
        dri-devel@...ts.freedesktop.org,
        Inaky Perez-Gonzalez <inaky.perez-gonzalez@...el.com>,
        Jürgen Groß <jgross@...e.com>,
        Leon Romanovsky <leon@...nel.org>,
        linux-arm-msm@...r.kernel.org, linux-fsdevel@...r.kernel.org,
        linux-input@...r.kernel.org, linux-kernel@...r.kernel.org,
        linux-ntfs-dev@...ts.sourceforge.net, linux-rdma@...r.kernel.org,
        linux-wimax@...el.com, linux-xfs@...r.kernel.org,
        Mike Marciniszyn <mike.marciniszyn@...el.com>,
        netdev@...r.kernel.org,
        Pali Rohár <pali.rohar@...il.com>,
        Rob Clark <robdclark@...il.com>,
        Saeed Mahameed <saeedm@...lanox.com>,
        Sean Paul <sean@...rly.run>,
        Alexander Viro <viro@...iv.linux.org.uk>,
        xen-devel@...ts.xenproject.org, Enrico Weigelt <lkml@...ux.net>
Subject: Re: [PATCH v3 01/11] checkpatch: check for nested (un)?likely() calls



On 31.08.2019 19:45, Markus Elfring wrote:
>>>> +# nested likely/unlikely calls
>>>> +        if ($line =~ /\b(?:(?:un)?likely)\s*\(\s*!?\s*(IS_ERR(?:_OR_NULL|_VALUE)?|WARN)/) {
>>>> +            WARN("LIKELY_MISUSE",
>>>
>>> How do you think about to use the specification “(?:IS_ERR(?:_(?:OR_NULL|VALUE))?|WARN)”
>>> in this regular expression?
> …
>>    IS_ERR
>>    (?:_ <- Another atomic group just to show that '_' is a common prefix?
> 
> Yes. - I hope that this specification detail can help a bit.

I'm not sure that another pair of brackets for a single char worth it.

>>            Usually, Perl interpreter is very good at optimizing such things.

The interpreter optimizes it internally:
echo 'IS_ERR_OR_NULL' | perl -Mre=debug -ne '/IS_ERR(?:_OR_NULL|_VALUE)?/ && print'
Compiling REx "IS_ERR(?:_OR_NULL|_VALUE)?"
Final program:
   1: EXACT <IS_ERR> (4)
   4: CURLYX[0]{0,1} (16)
   6:   EXACT <_> (8)      <-- common prefix
   8:   TRIE-EXACT[OV] (15)
        <OR_NULL> 
        <VALUE>
...
> 
> Would you like to help this software component by omitting a pair of
> non-capturing parentheses at the beginning?
> 
> \b(?:un)?likely\s*

This pair of brackets is required to match "unlikely" and it's
optional in order to match "likely".

Regards,
Denis

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ