summaryrefslogtreecommitdiffstats
path: root/fs/nls
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-09-30 18:31:14 +0200
committerLinus Torvalds <torvalds@linux-foundation.org>2009-09-30 18:31:14 +0200
commit4c8f1cb266cba4d1052f524d04df839d8f732ace (patch)
tree4bf2e6bcc56dcce2c919bca969f6626c8f18b7e6 /fs/nls
parentMerge branch 'pm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/rafa... (diff)
parentfat: Check s_dirt in fat_sync_fs() (diff)
downloadlinux-4c8f1cb266cba4d1052f524d04df839d8f732ace.tar.xz
linux-4c8f1cb266cba4d1052f524d04df839d8f732ace.zip
Merge git://git.kernel.org/pub/scm/linux/kernel/git/hirofumi/fatfs-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/hirofumi/fatfs-2.6: fat: Check s_dirt in fat_sync_fs() vfat: change the default from shortname=lower to shortname=mixed fat/nls: Fix handling of utf8 invalid char
Diffstat (limited to 'fs/nls')
-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 2224b4d07bf0..44a88a9fa2c8 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));