lkml.org 
[lkml]   [2020]   [Jan]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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@samsung.com>
> Signed-off-by: Sungjong Seo <sj1557.seo@samsung.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@gmail.com
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2020-01-05 16:25    [W:0.307 / U:0.276 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site