summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/md/bcache/journal.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/md/bcache/journal.c b/drivers/md/bcache/journal.c
index ab057cc1293d..4239844b6dec 100644
--- a/drivers/md/bcache/journal.c
+++ b/drivers/md/bcache/journal.c
@@ -1899,7 +1899,8 @@ static void journal_write_compact(struct jset *jset)
i->btree_id == prev->btree_id &&
i->level == prev->level &&
JOURNAL_ENTRY_TYPE(i) == JOURNAL_ENTRY_TYPE(prev) &&
- JOURNAL_ENTRY_TYPE(i) == JOURNAL_ENTRY_BTREE_KEYS) {
+ JOURNAL_ENTRY_TYPE(i) == JOURNAL_ENTRY_BTREE_KEYS &&
+ le16_to_cpu(prev->u64s) + u64s <= U16_MAX) {
memmove_u64s_down(jset_keys_next(prev),
i->_data,
u64s);