From: Kent Overstreet Date: Sun, 22 Oct 2023 21:22:53 +0000 (-0400) Subject: bcachefs: Fix bch2_prt_bitflags() X-Git-Tag: v6.7-rc1~50^2~50 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=48f866e90f520855b6d941eebe46d75dbfbb9a81;p=thirdparty%2Fkernel%2Flinux.git bcachefs: Fix bch2_prt_bitflags() This fixes an infinite loop when there's a set bit at position >= 32. Signed-off-by: Kent Overstreet --- diff --git a/fs/bcachefs/printbuf.c b/fs/bcachefs/printbuf.c index de41f9a144920..5e653eb81d54f 100644 --- a/fs/bcachefs/printbuf.c +++ b/fs/bcachefs/printbuf.c @@ -415,11 +415,11 @@ void bch2_prt_bitflags(struct printbuf *out, while (list[nr]) nr++; - while (flags && (bit = __ffs(flags)) < nr) { + while (flags && (bit = __ffs64(flags)) < nr) { if (!first) bch2_prt_printf(out, ","); first = false; bch2_prt_printf(out, "%s", list[bit]); - flags ^= 1 << bit; + flags ^= BIT_ULL(bit); } }