2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-19 18:53:52 +08:00

btrfs: Fix superblock csum type check.

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>
This commit is contained in:
Qu Wenruo 2015-05-05 10:53:15 +08:00 committed by Chris Mason
parent 619d8c4ef7
commit 1f6e4b3f9f

View File

@ -174,7 +174,7 @@ struct btrfs_ordered_sum;
/* csum types */ /* csum types */
#define BTRFS_CSUM_TYPE_CRC32 0 #define BTRFS_CSUM_TYPE_CRC32 0
static int btrfs_csum_sizes[] = { 4, 0 }; static int btrfs_csum_sizes[] = { 4 };
/* four bytes for CRC32 */ /* four bytes for CRC32 */
#define BTRFS_EMPTY_DIR_SIZE 0 #define BTRFS_EMPTY_DIR_SIZE 0