summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2016-10-04 02:30:38 -0800
committerKent Overstreet <kent.overstreet@gmail.com>2017-01-18 21:40:31 -0900
commit5825611f5280ef1cdd3874c4601697f07d20d46a (patch)
tree878555aa5878e26c90341c04f987a3684fc9832a
parentf2de97aa7a38a3b0d82a18c9feb3bf7a18bea518 (diff)
bcache: fix an assertion in bch_extent_invalid()
-rw-r--r--drivers/md/bcache/extents.c8
1 files 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);