Skip to content

Commit dddf7da

Browse files
palinamjaejeon
authored andcommitted
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 <[email protected]> Signed-off-by: Namjae Jeon <[email protected]>
1 parent 31f5acc commit dddf7da

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

fs/exfat/namei.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -147,16 +147,10 @@ static int exfat_utf8_d_hash(const struct dentry *dentry, struct qstr *qstr)
147147
return charlen;
148148

149149
/*
150-
* Convert to UTF-16: code points above U+FFFF are encoded as
151-
* surrogate pairs.
152150
* exfat_toupper() works only for code points up to the U+FFFF.
153151
*/
154-
if (u > 0xFFFF) {
155-
hash = partial_name_hash(exfat_high_surrogate(u), hash);
156-
hash = partial_name_hash(exfat_low_surrogate(u), hash);
157-
} else {
158-
hash = partial_name_hash(exfat_toupper(sb, u), hash);
159-
}
152+
hash = partial_name_hash(u <= 0xFFFF ? exfat_toupper(sb, u) : u,
153+
hash);
160154
}
161155

162156
qstr->hash = end_name_hash(hash);

0 commit comments

Comments
 (0)