From: Justin Husted Date: Wed, 9 Oct 2019 02:16:28 +0000 (-0700) Subject: bcachefs: Fix uninitialized data in bch2_gc_btree() X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=f7c0fcdd396ff4bd3175000eb3911f75edbc85c5;p=linux.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 f8485fba55e2b..f7d9abfdb3dea 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);