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: <CAHp75Vd1C1X7V4a9PzfFfCFi92M3iaZP_ahsOtGP7V5Y=1LjiQ@mail.gmail.com>
Date:   Tue, 5 Jun 2018 16:19:39 +0300
From:   Andy Shevchenko <andy.shevchenko@...il.com>
To:     Yisheng Xie <xieyisheng1@...wei.com>
Cc:     Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Ganesh Goudar <ganeshgr@...lsio.com>,
        netdev <netdev@...r.kernel.org>
Subject: Re: [PATCH v2 04/21] cxgb4: 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.
>

Reviewed-by: Andy Shevchenko <andy.shevchenko@...il.com>

> Cc: Ganesh Goudar <ganeshgr@...lsio.com>
> Cc: netdev@...r.kernel.org
> Signed-off-by: Yisheng Xie <xieyisheng1@...wei.com>
> ---
> v2:
>  - no change from v1.
>
>  drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.c | 14 ++++----------
>  1 file changed, 4 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.c b/drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.c
> index 9da6f57..bd61610 100644
> --- a/drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.c
> +++ b/drivers/net/ethernet/chelsio/cxgb4/cudbg_lib.c
> @@ -782,17 +782,11 @@ static int cudbg_get_mem_region(struct adapter *padap,
>         if (rc)
>                 return rc;
>
> -       for (i = 0; i < ARRAY_SIZE(cudbg_region); i++) {
> -               if (!strcmp(cudbg_region[i], region_name)) {
> -                       found = 1;
> -                       idx = i;
> -                       break;
> -               }
> -       }
> -       if (!found)
> -               return -EINVAL;
> +       rc = match_string(cudbg_region, ARRAY_SIZE(cudbg_region), region_name);
> +       if (rc < 0)
> +               return rc;
>
> -       found = 0;
> +       idx = rc;
>         for (i = 0; i < meminfo->mem_c; i++) {
>                 if (meminfo->mem[i].idx >= ARRAY_SIZE(cudbg_region))
>                         continue; /* Skip holes */
> --
> 1.7.12.4
>



-- 
With Best Regards,
Andy Shevchenko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ