#define SB_JOURNAL_BUCKETS 256U
#define node(i, j) ((i)->d + (j))
-#define end(i) node(i, (i)->keys)
+#define end(i) node(i, le16_to_cpu((i)->keys))
static const char bcache_magic[] = {
0xc6, 0x85, 0x73, 0xf6, 0x4e, 0x1a, 0x45, 0xca,
if (le64_to_cpu(bcs->offset) != BCACHE_SB_OFF / 512)
return BLKID_PROBE_NONE;
+ if (le16_to_cpu(bcs->keys) > SB_JOURNAL_BUCKETS)
+ return BLKID_PROBE_NONE;
if (!blkid_probe_verify_csum(pr, bcache_crc64(bcs), le64_to_cpu(bcs->csum)))
return BLKID_PROBE_NONE;