Skip to contentSkip to conversation

isofs/joliet broken on alpha

PATCH New Ivan Kokshaysky 1 participant 1 message Feb 26, 2001 Isofs filesystem

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 isofs/joliet broken on alpha

uni16_to_x8() loads unaligned u16 words, returning bogus file names on an ev5 and older alpha CPUs...

Ivan.

fs/isofs/joliet.c +4 -3
@@ -10,6 +10,7 @@
 #include <linux/nls.h>
 #include <linux/slab.h>
 #include <linux/iso_fs.h>
+#include <asm/unaligned.h>
 
 /*
  * Convert Unicode 16 to UTF8 or ASCII.
@@ -17,15 +18,15 @@
 static int
 uni16_to_x8(unsigned char *ascii, u16 *uni, int len, struct nls_table *nls)
 {
-	wchar_t *ip;
+	wchar_t *ip, ch;
 	unsigned char *op;
 
 	ip = uni;
 	op = ascii;
 
-	while (*ip && len) {
+	while ((ch = get_unaligned(ip)) && len) {
 		int llen;
-		wchar_t ch = be16_to_cpu(*ip);
+		ch = be16_to_cpu(ch);
 		if ((llen = nls->uni2char(ch, op, NLS_MAX_CHARSET_SIZE)) > 0)
 			op += llen;
 		else