summaryrefslogtreecommitdiff
path: root/fs/fat
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2011-11-17 16:42:19 -0500
committerWilly Tarreau <w@1wt.eu>2013-06-10 11:43:21 +0200
commit9ecb77213c3f5393deaf3d9c942d25ce31f80074 (patch)
treec2f329fce8458c046a4061a5c6050f90095e2545 /fs/fat
parentc71109d6d398e60fbe55102ae752f1c036cce27b (diff)
downloadlwn-9ecb77213c3f5393deaf3d9c942d25ce31f80074.tar.gz
lwn-9ecb77213c3f5393deaf3d9c942d25ce31f80074.zip
NLS: improve UTF8 -> UTF16 string conversion routine
commit 0720a06a7518c9d0c0125bd5d1f3b6264c55c3dd upstream. The utf8s_to_utf16s conversion routine needs to be improved. Unlike its utf16s_to_utf8s sibling, it doesn't accept arguments specifying the maximum length of the output buffer or the endianness of its 16-bit output. This patch (as1501) adds the two missing arguments, and adjusts the only two places in the kernel where the function is called. A follow-on patch will add a third caller that does utilize the new capabilities. The two conversion routines are still annoyingly inconsistent in the way they handle invalid byte combinations. But that's a subject for a different patch. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> CC: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> [bwh: Bakckported to 2.6.32: drop Hyper-V change] Signed-off-by: Ben Hutchings <ben@decadent.org.uk> Signed-off-by: Willy Tarreau <w@1wt.eu>
Diffstat (limited to 'fs/fat')
-rw-r--r--fs/fat/namei_vfat.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/fat/namei_vfat.c b/fs/fat/namei_vfat.c
index 67b3df1feae6..4251f357943c 100644
--- a/fs/fat/namei_vfat.c
+++ b/fs/fat/namei_vfat.c
@@ -499,7 +499,8 @@ xlate_to_uni(const unsigned char *name, int len, unsigned char *outname,
int charlen;
if (utf8) {
- *outlen = utf8s_to_utf16s(name, len, (wchar_t *)outname);
+ *outlen = utf8s_to_utf16s(name, len, UTF16_HOST_ENDIAN,
+ (wchar_t *) outname, FAT_LFN_LEN + 2);
if (*outlen < 0)
return *outlen;
else if (*outlen > FAT_LFN_LEN)