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: <CAJX1YtbXnPVbkpddXQf4MZ3sopoidr0fZ8OkrQegoLoCevaNwQ@mail.gmail.com>
Date:   Wed, 28 Apr 2021 07:41:51 +0200
From:   Gioh Kim <gi-oh.kim@...os.com>
To:     LKML <linux-kernel@...r.kernel.org>,
        Andrew Morton <akpm@...ux-foundation.org>
Cc:     Nick Desaulniers <ndesaulniers@...gle.com>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Subject: Re: [PATCH] lib/string: sysfs_streq works case insensitively

On Mon, Apr 12, 2021 at 1:33 PM Gioh Kim <gi-oh.kim@...os.com> wrote:
>
> As the name shows, it checks the strings inputed from sysfs.
> It should work for both case-sensitive filesystem and
> case-insensitive filesystem. Therefore sysfs_streq should work
> case-insensitively.
>
> Signed-off-by: Gioh Kim <gi-oh.kim@...os.com>
> ---
>  lib/string.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/lib/string.c b/lib/string.c
> index 7548eb715ddb..d0914dffdaae 100644
> --- a/lib/string.c
> +++ b/lib/string.c
> @@ -688,7 +688,8 @@ EXPORT_SYMBOL(strsep);
>  #endif
>
>  /**
> - * sysfs_streq - return true if strings are equal, modulo trailing newline
> + * sysfs_streq - return true if strings are equal case-insentively,
> + *               modulo trailing newline
>   * @s1: one string
>   * @s2: another string
>   *
> @@ -696,10 +697,11 @@ EXPORT_SYMBOL(strsep);
>   * NUL and newline-then-NUL as equivalent string terminations.  It's
>   * geared for use with sysfs input strings, which generally terminate
>   * with newlines but are compared against values without newlines.
> + * And case does not matter for the sysfs input strings comparison.
>   */
>  bool sysfs_streq(const char *s1, const char *s2)
>  {
> -       while (*s1 && *s1 == *s2) {
> +       while (*s1 && tolower(*s1) == tolower(*s2)) {
>                 s1++;
>                 s2++;
>         }
> --
> 2.25.1
>

Hi Andrew,

I changed sysfs_streq to be case-insensitive as you requested.
Is there any progress?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ