[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200105152447.jo27m7jgskyu2dos@pali>
Date: Sun, 5 Jan 2020 16:24:47 +0100
From: Pali Rohár <pali.rohar@...il.com>
To: Namjae Jeon <namjae.jeon@...sung.com>
Cc: linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org,
gregkh@...uxfoundation.org, valdis.kletnieks@...edu, hch@....de,
sj1557.seo@...sung.com, linkinjeon@...il.com
Subject: Re: [PATCH v9 10/13] exfat: add nls operations
On Thursday 02 January 2020 16:20:33 Namjae Jeon wrote:
> This adds the implementation of nls operations for exfat.
>
> Signed-off-by: Namjae Jeon <namjae.jeon@...sung.com>
> Signed-off-by: Sungjong Seo <sj1557.seo@...sung.com>
> ---
> fs/exfat/nls.c | 809 +++++++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 809 insertions(+)
> create mode 100644 fs/exfat/nls.c
>
> diff --git a/fs/exfat/nls.c b/fs/exfat/nls.c
> new file mode 100644
> index 000000000000..af52328e28ff
> --- /dev/null
> +++ b/fs/exfat/nls.c
...
> +int exfat_nls_cmp_uniname(struct super_block *sb, unsigned short *a,
> + unsigned short *b)
> +{
> + int i;
> +
> + for (i = 0; i < MAX_NAME_LENGTH; i++, a++, b++) {
> + if (exfat_nls_upper(sb, *a) != exfat_nls_upper(sb, *b))
> + return 1;
> + if (*a == 0x0)
> + return 0;
> + }
> + return 0;
> +}
Hello, this function returns wrong result when second string (b) is
longer then first string (a).
Also it is a best practise to first check for end-of-string and then
access/work with i-th element of string.
--
Pali Rohár
pali.rohar@...il.com
Download attachment "signature.asc" of type "application/pgp-signature" (196 bytes)
Powered by blists - more mailing lists