提交 b8cc936f 编写于 作者: A Al Viro 提交者: Linus Torvalds

[PATCH] reiserfs endianness: fix endianness bugs

fixes for a couple of bugs exposed by the above: le32_to_cpu() used on 16bit
value and missing conversion in comparison of host- and little-endian values.
Signed-off-by: NAl Viro <viro@parcelfarce.linux.theplanet.co.uk>
Cc: <reiserfs-dev@namesys.com>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 3e8962be
...@@ -2391,7 +2391,7 @@ int journal_init(struct super_block *p_s_sb, const char * j_dev_name, int old_fo ...@@ -2391,7 +2391,7 @@ int journal_init(struct super_block *p_s_sb, const char * j_dev_name, int old_fo
jh = (struct reiserfs_journal_header *)(bhjh->b_data); jh = (struct reiserfs_journal_header *)(bhjh->b_data);
/* make sure that journal matches to the super block */ /* make sure that journal matches to the super block */
if (is_reiserfs_jr(rs) && (jh->jh_journal.jp_journal_magic != sb_jp_journal_magic(rs))) { if (is_reiserfs_jr(rs) && (le32_to_cpu(jh->jh_journal.jp_journal_magic) != sb_jp_journal_magic(rs))) {
reiserfs_warning (p_s_sb, "sh-460: journal header magic %x " reiserfs_warning (p_s_sb, "sh-460: journal header magic %x "
"(device %s) does not match to magic found in super " "(device %s) does not match to magic found in super "
"block %x", "block %x",
......
...@@ -225,7 +225,7 @@ struct reiserfs_super_block ...@@ -225,7 +225,7 @@ struct reiserfs_super_block
#define SB_ONDISK_JOURNAL_DEVICE(s) \ #define SB_ONDISK_JOURNAL_DEVICE(s) \
le32_to_cpu ((SB_ONDISK_JP(s)->jp_journal_dev)) le32_to_cpu ((SB_ONDISK_JP(s)->jp_journal_dev))
#define SB_ONDISK_RESERVED_FOR_JOURNAL(s) \ #define SB_ONDISK_RESERVED_FOR_JOURNAL(s) \
le32_to_cpu ((SB_V1_DISK_SUPER_BLOCK(s)->s_reserved_for_journal)) le16_to_cpu ((SB_V1_DISK_SUPER_BLOCK(s)->s_reserved_for_journal))
#define is_block_in_log_or_reserved_area(s, block) \ #define is_block_in_log_or_reserved_area(s, block) \
block >= SB_JOURNAL_1st_RESERVED_BLOCK(s) \ block >= SB_JOURNAL_1st_RESERVED_BLOCK(s) \
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册