summaryrefslogtreecommitdiff
path: root/drivers/md/bcache/super.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/md/bcache/super.c')
-rw-r--r--drivers/md/bcache/super.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c
index a7dd332b17d8..7f25591f7897 100644
--- a/drivers/md/bcache/super.c
+++ b/drivers/md/bcache/super.c
@@ -261,6 +261,12 @@ const char *validate_super(struct bcache_superblock *disk_sb,
if (!CACHE_BTREE_NODE_SIZE(sb))
return "Btree node size not set";
+ if (!is_power_of_2(CACHE_BTREE_NODE_SIZE(sb)))
+ return "Btree node size not a power of two";
+
+ if (CACHE_BTREE_NODE_SIZE(sb) > BTREE_NODE_SIZE_MAX)
+ return "Btree node size too large";
+
if (sb->u64s < bch_journal_buckets_offset(sb))
return "Invalid superblock: member info area missing";