summaryrefslogtreecommitdiff
path: root/fs/exfat/namei.c
diff options
context:
space:
mode:
authorPali Rohár <pali@kernel.org>2020-03-18 01:25:52 +0300
committerNamjae Jeon <namjae.jeon@samsung.com>2020-06-09 10:48:44 +0300
commitdddf7da3985ee144b46ee287e81e47b9ee8bb980 (patch)
tree6709f28baaf36b94e74dc0198896295e1d20b9a2 /fs/exfat/namei.c
parent31f5acc0aaa319a34308442413ef0b878e9d2c93 (diff)
downloadlinux-dddf7da3985ee144b46ee287e81e47b9ee8bb980.tar.xz
exfat: Simplify exfat_utf8_d_hash() for code points above U+FFFF
Function partial_name_hash() takes long type value into which can be stored one Unicode code point. Therefore conversion from UTF-32 to UTF-16 is not needed. Signed-off-by: Pali Rohár <pali@kernel.org> Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Diffstat (limited to 'fs/exfat/namei.c')
-rw-r--r--fs/exfat/namei.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/fs/exfat/namei.c b/fs/exfat/namei.c
index 585b47b2db3d..fa926b9c883a 100644
--- a/fs/exfat/namei.c
+++ b/fs/exfat/namei.c
@@ -147,16 +147,10 @@ static int exfat_utf8_d_hash(const struct dentry *dentry, struct qstr *qstr)
return charlen;
/*
- * Convert to UTF-16: code points above U+FFFF are encoded as
- * surrogate pairs.
* exfat_toupper() works only for code points up to the U+FFFF.
*/
- if (u > 0xFFFF) {
- hash = partial_name_hash(exfat_high_surrogate(u), hash);
- hash = partial_name_hash(exfat_low_surrogate(u), hash);
- } else {
- hash = partial_name_hash(exfat_toupper(sb, u), hash);
- }
+ hash = partial_name_hash(u <= 0xFFFF ? exfat_toupper(sb, u) : u,
+ hash);
}
qstr->hash = end_name_hash(hash);