From: Justin Husted Date: Wed, 9 Oct 2019 02:16:28 +0000 (-0700) Subject: bcachefs: Fix uninitialized data in bch2_gc_btree() X-Git-Tag: io_uring-6.7-2023-11-10~119^2~2311 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=f7c0fcdd396ff4bd3175000eb3911f75edbc85c5;p=linux-block.git bcachefs: Fix uninitialized data in bch2_gc_btree() Running the filesystem under valgrind exposed a path where the max_stale variable in bch2_gc_btree() might not be initialized before use in a rare case when there are no btree nodes in a transaction. Signed-off-by: Justin Husted Signed-off-by: Kent Overstreet --- diff --git a/fs/bcachefs/btree_gc.c b/fs/bcachefs/btree_gc.c index f8485fba55e2..f7d9abfdb3de 100644 --- a/fs/bcachefs/btree_gc.c +++ b/fs/bcachefs/btree_gc.c @@ -218,7 +218,7 @@ static int bch2_gc_btree(struct bch_fs *c, enum btree_id btree_id, : expensive_debug_checks(c) ? 0 : !btree_node_type_needs_gc(btree_id) ? 1 : 0; - u8 max_stale; + u8 max_stale = 0; int ret = 0; bch2_trans_init(&trans, c, 0, 0);