diff options
Diffstat (limited to 'fs/fat/inode.c')
-rw-r--r-- | fs/fat/inode.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/fs/fat/inode.c b/fs/fat/inode.c index 65cb54bde481..a8129e82d594 100644 --- a/fs/fat/inode.c +++ b/fs/fat/inode.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/parser.h> | 25 | #include <linux/parser.h> |
26 | #include <linux/uio.h> | 26 | #include <linux/uio.h> |
27 | #include <linux/writeback.h> | 27 | #include <linux/writeback.h> |
28 | #include <linux/log2.h> | ||
28 | #include <asm/unaligned.h> | 29 | #include <asm/unaligned.h> |
29 | 30 | ||
30 | #ifndef CONFIG_FAT_DEFAULT_IOCHARSET | 31 | #ifndef CONFIG_FAT_DEFAULT_IOCHARSET |
@@ -1217,8 +1218,7 @@ int fat_fill_super(struct super_block *sb, void *data, int silent, | |||
1217 | } | 1218 | } |
1218 | logical_sector_size = | 1219 | logical_sector_size = |
1219 | le16_to_cpu(get_unaligned((__le16 *)&b->sector_size)); | 1220 | le16_to_cpu(get_unaligned((__le16 *)&b->sector_size)); |
1220 | if (!logical_sector_size | 1221 | if (!is_power_of_2(logical_sector_size) |
1221 | || (logical_sector_size & (logical_sector_size - 1)) | ||
1222 | || (logical_sector_size < 512) | 1222 | || (logical_sector_size < 512) |
1223 | || (PAGE_CACHE_SIZE < logical_sector_size)) { | 1223 | || (PAGE_CACHE_SIZE < logical_sector_size)) { |
1224 | if (!silent) | 1224 | if (!silent) |
@@ -1228,8 +1228,7 @@ int fat_fill_super(struct super_block *sb, void *data, int silent, | |||
1228 | goto out_invalid; | 1228 | goto out_invalid; |
1229 | } | 1229 | } |
1230 | sbi->sec_per_clus = b->sec_per_clus; | 1230 | sbi->sec_per_clus = b->sec_per_clus; |
1231 | if (!sbi->sec_per_clus | 1231 | if (!is_power_of_2(sbi->sec_per_clus)) { |
1232 | || (sbi->sec_per_clus & (sbi->sec_per_clus - 1))) { | ||
1233 | if (!silent) | 1232 | if (!silent) |
1234 | printk(KERN_ERR "FAT: bogus sectors per cluster %u\n", | 1233 | printk(KERN_ERR "FAT: bogus sectors per cluster %u\n", |
1235 | sbi->sec_per_clus); | 1234 | sbi->sec_per_clus); |