[patch] isofs: alignment fix for uni16_to_x8()

From: Ivan Kokshaysky (ink@jurassic.park.msu.ru)
Date: Fri Aug 25 2000 - 10:47:33 EST


With some CDs on alpha I have a LOT of unaligned traps
while reading directories. Here is a fix.

Ivan.

--- 2.4.0t7/fs/isofs/joliet.c Tue Aug 1 18:55:42 2000
+++ linux/fs/isofs/joliet.c Fri Aug 25 18:42:45 2000
@@ -10,6 +10,7 @@
 #include <linux/nls.h>
 #include <linux/malloc.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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Thu Aug 31 2000 - 21:00:16 EST