UPSTREAM: of/pci: Add helper function to parse max-link-speed from dt
[firefly-linux-kernel-4.4.55.git] / fs / nilfs2 / the_nilfs.c
index 69bd801afb53b987ea3fa862fd2a444b41d2efdb..37e49cb2ac4c4a61d61357272a2ee168165bf793 100644 (file)
@@ -443,7 +443,7 @@ static int nilfs_valid_sb(struct nilfs_super_block *sbp)
        if (!sbp || le16_to_cpu(sbp->s_magic) != NILFS_SUPER_MAGIC)
                return 0;
        bytes = le16_to_cpu(sbp->s_bytes);
-       if (bytes > BLOCK_SIZE)
+       if (bytes < sumoff + 4 || bytes > BLOCK_SIZE)
                return 0;
        crc = crc32_le(le32_to_cpu(sbp->s_crc_seed), (unsigned char *)sbp,
                       sumoff);