diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2012-04-13 01:24:37 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2012-05-29 23:28:36 -0400 |
commit | de5e2b36289e6c81c3f7dcb9eef38d78de1f8b5c (patch) | |
tree | 074deb87c58dcbbcf8b78745ced87bf7349bc706 /fs | |
parent | 528c032764f4d3c6cb5f5ece090d9d5882655982 (diff) |
hpfs: endianness bugs
a couple of le32 and le16 used with wrong le..._to_cpu(), plus
idiotic use of le32_to_cpu() on 1-bit bitfield
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/hpfs/ea.c | 2 | ||||
-rw-r--r-- | fs/hpfs/super.c | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/fs/hpfs/ea.c b/fs/hpfs/ea.c index d8b84d113c89..cd098e3eb0e6 100644 --- a/fs/hpfs/ea.c +++ b/fs/hpfs/ea.c | |||
@@ -246,7 +246,7 @@ void hpfs_set_ea(struct inode *inode, struct fnode *fnode, const char *key, | |||
246 | if (le16_to_cpu(fnode->ea_offs) < 0xc4 || le16_to_cpu(fnode->ea_offs) + le16_to_cpu(fnode->acl_size_s) + le16_to_cpu(fnode->ea_size_s) > 0x200) { | 246 | if (le16_to_cpu(fnode->ea_offs) < 0xc4 || le16_to_cpu(fnode->ea_offs) + le16_to_cpu(fnode->acl_size_s) + le16_to_cpu(fnode->ea_size_s) > 0x200) { |
247 | hpfs_error(s, "fnode %08lx: ea_offs == %03x, ea_size_s == %03x", | 247 | hpfs_error(s, "fnode %08lx: ea_offs == %03x, ea_size_s == %03x", |
248 | (unsigned long)inode->i_ino, | 248 | (unsigned long)inode->i_ino, |
249 | le32_to_cpu(fnode->ea_offs), le16_to_cpu(fnode->ea_size_s)); | 249 | le16_to_cpu(fnode->ea_offs), le16_to_cpu(fnode->ea_size_s)); |
250 | return; | 250 | return; |
251 | } | 251 | } |
252 | if ((le16_to_cpu(fnode->ea_size_s) || !le32_to_cpu(fnode->ea_size_l)) && | 252 | if ((le16_to_cpu(fnode->ea_size_s) || !le32_to_cpu(fnode->ea_size_l)) && |
diff --git a/fs/hpfs/super.c b/fs/hpfs/super.c index 54f6eccb79d9..08e85b019131 100644 --- a/fs/hpfs/super.c +++ b/fs/hpfs/super.c | |||
@@ -572,7 +572,7 @@ static int hpfs_fill_super(struct super_block *s, void *options, int silent) | |||
572 | mark_buffer_dirty(bh2); | 572 | mark_buffer_dirty(bh2); |
573 | } | 573 | } |
574 | 574 | ||
575 | if (le32_to_cpu(spareblock->hotfixes_used) || le32_to_cpu(spareblock->n_spares_used)) { | 575 | if (spareblock->hotfixes_used || le32_to_cpu(spareblock->n_spares_used)) { |
576 | if (errs >= 2) { | 576 | if (errs >= 2) { |
577 | printk("HPFS: Hotfixes not supported here, try chkdsk\n"); | 577 | printk("HPFS: Hotfixes not supported here, try chkdsk\n"); |
578 | mark_dirty(s, 0); | 578 | mark_dirty(s, 0); |
@@ -645,7 +645,7 @@ static int hpfs_fill_super(struct super_block *s, void *options, int silent) | |||
645 | root->i_mtime.tv_nsec = 0; | 645 | root->i_mtime.tv_nsec = 0; |
646 | root->i_ctime.tv_sec = local_to_gmt(s, le32_to_cpu(de->creation_date)); | 646 | root->i_ctime.tv_sec = local_to_gmt(s, le32_to_cpu(de->creation_date)); |
647 | root->i_ctime.tv_nsec = 0; | 647 | root->i_ctime.tv_nsec = 0; |
648 | hpfs_i(root)->i_ea_size = le16_to_cpu(de->ea_size); | 648 | hpfs_i(root)->i_ea_size = le32_to_cpu(de->ea_size); |
649 | hpfs_i(root)->i_parent_dir = root->i_ino; | 649 | hpfs_i(root)->i_parent_dir = root->i_ino; |
650 | if (root->i_size == -1) | 650 | if (root->i_size == -1) |
651 | root->i_size = 2048; | 651 | root->i_size = 2048; |