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] [day] [month] [year] [list]
Message-ID: <20210815171200.GA103145@titan>
Date:   Sun, 15 Aug 2021 19:12:00 +0200
From:   Len Baker <len.baker@....com>
To:     Joe Perches <joe@...ches.com>
Cc:     Len Baker <len.baker@....com>,
        Andy Shevchenko <andy.shevchenko@...il.com>,
        Jonathan Cameron <jic23@...nel.org>,
        Lars-Peter Clausen <lars@...afoo.de>,
        David Laight <David.Laight@...lab.com>,
        Kees Cook <keescook@...omium.org>,
        linux-hardening@...r.kernel.org,
        linux-iio <linux-iio@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v4] drivers/iio: Remove all strcpy() uses

Hi,

On Sun, Aug 15, 2021 at 09:58:02AM -0700, Joe Perches wrote:
> On Sun, 2021-08-15 at 18:36 +0200, Len Baker wrote:
> > Hi Joe,
>
> Hello Len.
>
> Don't take this advice too seriously, it's just bikeshedding
> but it seems to me an unexpected use of a strcmp equivalent
> in a non performance sensitive path.
>
> > On Sun, Aug 15, 2021 at 08:06:45AM -0700, Joe Perches wrote:
> []
> > > bikeshed:
> > >
> > > I think this change is less intelligible than the original strcmp.
> >
> > So, if I understand correctly you suggest to change the above line for:
> >                               else if (strcmp(orient, "0") == 0)
>
> Yes.
>
> In kernel sources it's about 2:1 in favor of '!strcmp()' over 'strcmp() == 0'
>
> $ git grep -P '\!\s*strcmp\b' | wc -l
> 3457
> $ git grep -P '\bstrcmp\s*\([^\)]+\)\s*==\s*0\b' | wc -l
> 1719
>
> And it's your choice to use one or the other or just your V4 patch.

I will increase the !strcmp() statistics ;)

>
> btw, according to godbolt:
>
> gcc -O2 doesn't call strcmp and produces the same object code as your
> byte comparisons.  clang 11 calls strcmp regardless of optimization level.
>
>

Thanks for the feedback,
Len

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ