summaryrefslogtreecommitdiffstats
path: root/fs/bcachefs/super-io.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2024-05-06 15:10:29 +0200
committerKent Overstreet <kent.overstreet@linux.dev>2024-05-06 16:58:17 +0200
commit71dac2482ad3c8d4a8b8998a96751f009bad895f (patch)
treefca99859ccf4373a592600cd9c57c4c80deb07f8 /fs/bcachefs/super-io.c
parentbcachefs: Add missing skcipher_request_set_callback() call (diff)
downloadlinux-71dac2482ad3c8d4a8b8998a96751f009bad895f.tar.xz
linux-71dac2482ad3c8d4a8b8998a96751f009bad895f.zip
bcachefs: BCH_SB_LAYOUT_SIZE_BITS_MAX
Define a constant for the max superblock size, to avoid a too-large shift. Reported-by: syzbot+a8b0fb419355c91dda7f@syzkaller.appspotmail.com Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to '')
-rw-r--r--fs/bcachefs/super-io.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/bcachefs/super-io.c b/fs/bcachefs/super-io.c
index e7527d551e3c..989d16bba8f0 100644
--- a/fs/bcachefs/super-io.c
+++ b/fs/bcachefs/super-io.c
@@ -649,7 +649,7 @@ reread:
bytes = vstruct_bytes(sb->sb);
- if (bytes > 512 << sb->sb->layout.sb_max_size_bits) {
+ if (bytes > 512ULL << min(BCH_SB_LAYOUT_SIZE_BITS_MAX, sb->sb->layout.sb_max_size_bits)) {
prt_printf(err, "Invalid superblock: too big (got %zu bytes, layout max %lu)",
bytes, 512UL << sb->sb->layout.sb_max_size_bits);
return -BCH_ERR_invalid_sb_too_big;