aboutsummaryrefslogtreecommitdiff
path: root/fs/nls/nls_base.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nls/nls_base.c')
-rw-r--r--fs/nls/nls_base.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/fs/nls/nls_base.c b/fs/nls/nls_base.c
index 477d37d83b3..b25c218671b 100644
--- a/fs/nls/nls_base.c
+++ b/fs/nls/nls_base.c
@@ -124,10 +124,10 @@ int utf8s_to_utf16s(const u8 *s, int len, wchar_t *pwcs)
while (*s && len > 0) {
if (*s & 0x80) {
size = utf8_to_utf32(s, len, &u);
- if (size < 0) {
- /* Ignore character and move on */
- size = 1;
- } else if (u >= PLANE_SIZE) {
+ if (size < 0)
+ return -EINVAL;
+
+ if (u >= PLANE_SIZE) {
u -= PLANE_SIZE;
*op++ = (wchar_t) (SURROGATE_PAIR |
((u >> 10) & SURROGATE_BITS));