btrfs-progs: dump-super: Don't verify csum if csum type or size is unknown
authorQu Wenruo <wqu@suse.com>
Tue, 6 Mar 2018 02:16:51 +0000 (10:16 +0800)
committerDavid Sterba <dsterba@suse.com>
Fri, 30 Mar 2018 20:15:53 +0000 (22:15 +0200)
Reported-by: Ken Swenson <flat@imo.uto.moe>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
cmds-inspect-dump-super.c

index 150c2e5..85bff26 100644 (file)
@@ -339,7 +339,9 @@ static void dump_superblock(struct btrfs_super_block *sb, int full)
        printf("csum\t\t\t0x");
        for (i = 0, p = sb->csum; i < csum_size; i++)
                printf("%02x", p[i]);
-       if (check_csum_sblock(sb, csum_size))
+       if (csum_type != BTRFS_CSUM_TYPE_CRC32 || csum_size != BTRFS_CRC32_SIZE)
+               printf(" [UNKNOWN CSUM TYPE OR SIZE]");
+       else if (check_csum_sblock(sb, csum_size))
                printf(" [match]");
        else
                printf(" [DON'T MATCH]");