Commit 086b4866 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] fix endian problem in ext3 htree code

Patch from Christopher Li <chrisl@vmware.com>

This little patch will fix two place in htree code which
forget the "cpu_to_le16" converting . This bug causes
incorrect record length on PPC.

Thanks Franz for report the problem.
parent 443bfb9d
...@@ -1018,7 +1018,8 @@ dx_move_dirents(char *from, char *to, struct dx_map_entry *map, int count) ...@@ -1018,7 +1018,8 @@ dx_move_dirents(char *from, char *to, struct dx_map_entry *map, int count)
struct ext3_dir_entry_2 *de = (struct ext3_dir_entry_2 *) (from + map->offs); struct ext3_dir_entry_2 *de = (struct ext3_dir_entry_2 *) (from + map->offs);
rec_len = EXT3_DIR_REC_LEN(de->name_len); rec_len = EXT3_DIR_REC_LEN(de->name_len);
memcpy (to, de, rec_len); memcpy (to, de, rec_len);
((struct ext3_dir_entry_2 *) to)->rec_len = rec_len; ((struct ext3_dir_entry_2 *) to)->rec_len =
cpu_to_le16(rec_len);
de->inode = 0; de->inode = 0;
map++; map++;
to += rec_len; to += rec_len;
...@@ -1039,7 +1040,7 @@ static struct ext3_dir_entry_2* dx_pack_dirents(char *base, int size) ...@@ -1039,7 +1040,7 @@ static struct ext3_dir_entry_2* dx_pack_dirents(char *base, int size)
rec_len = EXT3_DIR_REC_LEN(de->name_len); rec_len = EXT3_DIR_REC_LEN(de->name_len);
if (de > to) if (de > to)
memmove(to, de, rec_len); memmove(to, de, rec_len);
to->rec_len = rec_len; to->rec_len = cpu_to_le16(rec_len);
prev = to; prev = to;
to = (struct ext3_dir_entry_2 *) (((char *) to) + rec_len); to = (struct ext3_dir_entry_2 *) (((char *) to) + rec_len);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment