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: <CAHp75VeM8+pWEx=XNOGAb=Fdh+rh3WOn2i4m7ObhcVdcXKVa3A@mail.gmail.com>
Date:   Fri, 1 Jun 2018 14:34:23 +0300
From:   Andy Shevchenko <andy.shevchenko@...il.com>
To:     Yisheng Xie <xieyisheng1@...wei.com>
Cc:     Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        "David S. Miller" <davem@...emloft.net>,
        Anthony Yznaga <anthony.yznaga@...cle.com>,
        Pavel Tatashin <pasha.tatashin@...cle.com>,
        sparclinux@...r.kernel.org
Subject: Re: [PATCH v2 21/21] sparc64: use match_string() helper

On Thu, May 31, 2018 at 2:11 PM, Yisheng Xie <xieyisheng1@...wei.com> wrote:
> match_string() returns the index of an array for a matching string,
> which can be used instead of open coded variant.

> @@ -512,10 +512,9 @@ static unsigned long __init mdesc_cpu_hwcap_list(void)
>                                 break;
>                         }
>                 }

It seems previous loop also can be replaced.

> -               for (i = 0; i < ARRAY_SIZE(crypto_hwcaps); i++) {
> -                       if (!strcmp(prop, crypto_hwcaps[i]))
> -                               caps |= HWCAP_SPARC_CRYPTO;
> -               }
> +               i = match_string(crypto_hwcaps, ARRAY_SIZE(crypto_hwcaps), prop);
> +               if (i >= 0)
> +                       caps |= HWCAP_SPARC_CRYPTO;
>
>                 plen = strlen(prop) + 1;
>                 prop += plen;
> --
> 1.7.12.4
>



-- 
With Best Regards,
Andy Shevchenko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ