]> git.karo-electronics.de Git - linux-beck.git/commitdiff
btrfs: Fix superblock csum type check.
authorQu Wenruo <quwenruo@cn.fujitsu.com>
Tue, 5 May 2015 02:53:15 +0000 (10:53 +0800)
committerChris Mason <clm@fb.com>
Wed, 3 Jun 2015 02:34:35 +0000 (19:34 -0700)
Old csum type check is wrong and can't catch csum_type 1(not supported).

Fix it to avoid hostile 0 division.

Reported-by: Lukas Lueg <lukas.lueg@gmail.com>
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Reviewed-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <clm@fb.com>
fs/btrfs/ctree.h

index 670e4be7225bc51db35416b02285ee552c1acacb..9d7a6c38f0b107e8cc15cf08b1cd9c3310bc5dd5 100644 (file)
@@ -174,7 +174,7 @@ struct btrfs_ordered_sum;
 /* csum types */
 #define BTRFS_CSUM_TYPE_CRC32  0
 
-static int btrfs_csum_sizes[] = { 4, 0 };
+static int btrfs_csum_sizes[] = { 4 };
 
 /* four bytes for CRC32 */
 #define BTRFS_EMPTY_DIR_SIZE 0