bcachefs: Fix invalid shift in member_to_text()
PATCH 1/1 bcachefs: Fix invalid shift in member_to_text()
Reported-by [email protected]
Signed-off-by Kent Overstreet <[email protected]>
--- fs/bcachefs/sb-members.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
fs/bcachefs/sb-members.c +4 -1
@@ -247,7 +247,10 @@ static void member_to_text(struct printbuf *out,prt_newline (out);prt_printf (out,"Btree allocated bitmap blocksize:\t" ); -prt_units_u64 (out,1ULL << m.btree_bitmap_shift); +if (m.btree_bitmap_shift <64 ) +prt_units_u64 (out,1ULL << m.btree_bitmap_shift); +else +prt_printf (out,"(invalid shift %u)" , m.btree_bitmap_shift);prt_newline (out);prt_printf (out,"Btree allocated bitmap:\t" );
Signature · 1 line
2.45.2
Quoted 11 lines · Kent Overstreet
Reported-by [email protected]Signed-off-by Kent Overstreet <[email protected]>--- fs/bcachefs/sb-members.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)fs/bcachefs/sb-members.c +0
-0
fs/bcachefs/sb-members.c static void member_to_text(struct printbuf *out, · line 253
Quoted 8 lines
fs/bcachefs/sb-members.c +4
-1@@ -247,7 +247,10 @@ static void member_to_text(struct printbuf *out,prt_newline (out);prt_printf (out,"Btree allocated bitmap blocksize:\t" ); -prt_units_u64 (out,1ULL << m.btree_bitmap_shift); +if (m.btree_bitmap_shift <64 ) +prt_units_u64 (out,1ULL << m.btree_bitmap_shift); +else +prt_printf (out,"(invalid shift %u)" , m.btree_bitmap_shift);
I wonder why we don't check in .validate, like the former csum_granularity_bits does.
Thanks,
Hongbo
Quoted 3 lines
fs/bcachefs/sb-members.c +0
-0prt_newline (out);prt_printf (out,"Btree allocated bitmap:\t" );
Quoted 9 lines · Hongbo Li
Quoted 6 lines · Kent Overstreet
Reported-by [email protected]Signed-off-by Kent Overstreet <[email protected]>--- fs/bcachefs/sb-members.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
Quoted 15 lines
fs/bcachefs/sb-members.c static void member_to_text(struct printbuf *out, · line 252
Quoted 12 lines
fs/bcachefs/sb-members.c +4
-1@@ -247,7 +247,10 @@ static void member_to_text(struct printbuf *out,prt_newline (out);prt_printf (out,"Btree allocated bitmap blocksize:\t" ); -prt_units_u64 (out,1ULL << m.btree_bitmap_shift); +if (m.btree_bitmap_shift <64 ) +prt_units_u64 (out,1ULL << m.btree_bitmap_shift); +else +prt_printf (out,"(invalid shift %u)" , m.btree_bitmap_shift);I wonder why we don't check in .validate, like the former
csum_granularity_bitsdoes.
actually we need to do both; we want to be able to print things that don't validate so that we can debug. I'll make that change, thanks