From 5825611f5280ef1cdd3874c4601697f07d20d46a Mon Sep 17 00:00:00 2001 From: Kent Overstreet Date: Tue, 4 Oct 2016 02:30:38 -0800 Subject: bcache: fix an assertion in bch_extent_invalid() --- drivers/md/bcache/extents.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/md/bcache/extents.c b/drivers/md/bcache/extents.c index 1f6e19867b61..e3de4463f5b4 100644 --- a/drivers/md/bcache/extents.c +++ b/drivers/md/bcache/extents.c @@ -1531,12 +1531,8 @@ static const char *bch_extent_invalid(const struct cache_set *c, case BCH_EXTENT_ENTRY_crc64: crc = entry_to_crc(entry); - reason = "checksum uncompressed size < key size"; - if (crc_uncompressed_size(crc) < e.k->size) - goto invalid; - - reason = "checksum offset > uncompressed size"; - if (crc_offset(crc) >= crc_uncompressed_size(crc)) + reason = "checksum offset + key size > uncompressed size"; + if (crc_offset(crc) + e.k->size > crc_uncompressed_size(crc)) goto invalid; size_ondisk = crc_compressed_size(crc); -- cgit v1.2.3