提交 803f445f 编写于 作者: H Harvey Harrison 提交者: Linus Torvalds

fat: use get/put_unaligned_* helpers

Signed-off-by: NHarvey Harrison <harvey.harrison@gmail.com>
Acked-by: NOGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 d15c0a4d
...@@ -1222,8 +1222,7 @@ int fat_fill_super(struct super_block *sb, void *data, int silent, ...@@ -1222,8 +1222,7 @@ int fat_fill_super(struct super_block *sb, void *data, int silent,
brelse(bh); brelse(bh);
goto out_invalid; goto out_invalid;
} }
logical_sector_size = logical_sector_size = get_unaligned_le16(&b->sector_size);
le16_to_cpu(get_unaligned((__le16 *)&b->sector_size));
if (!is_power_of_2(logical_sector_size) if (!is_power_of_2(logical_sector_size)
|| (logical_sector_size < 512) || (logical_sector_size < 512)
|| (logical_sector_size > 4096)) { || (logical_sector_size > 4096)) {
...@@ -1322,8 +1321,7 @@ int fat_fill_super(struct super_block *sb, void *data, int silent, ...@@ -1322,8 +1321,7 @@ int fat_fill_super(struct super_block *sb, void *data, int silent,
sbi->dir_per_block_bits = ffs(sbi->dir_per_block) - 1; sbi->dir_per_block_bits = ffs(sbi->dir_per_block) - 1;
sbi->dir_start = sbi->fat_start + sbi->fats * sbi->fat_length; sbi->dir_start = sbi->fat_start + sbi->fats * sbi->fat_length;
sbi->dir_entries = sbi->dir_entries = get_unaligned_le16(&b->dir_entries);
le16_to_cpu(get_unaligned((__le16 *)&b->dir_entries));
if (sbi->dir_entries & (sbi->dir_per_block - 1)) { if (sbi->dir_entries & (sbi->dir_per_block - 1)) {
if (!silent) if (!silent)
printk(KERN_ERR "FAT: bogus directroy-entries per block" printk(KERN_ERR "FAT: bogus directroy-entries per block"
...@@ -1335,7 +1333,7 @@ int fat_fill_super(struct super_block *sb, void *data, int silent, ...@@ -1335,7 +1333,7 @@ int fat_fill_super(struct super_block *sb, void *data, int silent,
rootdir_sectors = sbi->dir_entries rootdir_sectors = sbi->dir_entries
* sizeof(struct msdos_dir_entry) / sb->s_blocksize; * sizeof(struct msdos_dir_entry) / sb->s_blocksize;
sbi->data_start = sbi->dir_start + rootdir_sectors; sbi->data_start = sbi->dir_start + rootdir_sectors;
total_sectors = le16_to_cpu(get_unaligned((__le16 *)&b->sectors)); total_sectors = get_unaligned_le16(&b->sectors);
if (total_sectors == 0) if (total_sectors == 0)
total_sectors = le32_to_cpu(b->total_sect); total_sectors = le32_to_cpu(b->total_sect);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册