diff options
author | Coly Li <colyli@suse.de> | 2022-05-27 23:28:16 +0800 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2022-05-27 09:49:48 -0600 |
commit | 7d6b902ea0e02b2a25c480edf471cbaa4ebe6b3c (patch) | |
tree | 1916bed2cf5994d69a0042b71b78bca492bc22f1 /drivers/md/bcache/btree.c | |
parent | b9684a71fca793213378dd410cd11675d973eaa1 (diff) | |
download | lwn-7d6b902ea0e02b2a25c480edf471cbaa4ebe6b3c.tar.gz lwn-7d6b902ea0e02b2a25c480edf471cbaa4ebe6b3c.zip |
bcache: memset on stack variables in bch_btree_check() and bch_sectors_dirty_init()
The local variables check_state (in bch_btree_check()) and state (in
bch_sectors_dirty_init()) should be fully filled by 0, because before
allocating them on stack, they were dynamically allocated by kzalloc().
Signed-off-by: Coly Li <colyli@suse.de>
Link: https://lore.kernel.org/r/20220527152818.27545-2-colyli@suse.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/md/bcache/btree.c')
-rw-r--r-- | drivers/md/bcache/btree.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/md/bcache/btree.c b/drivers/md/bcache/btree.c index 2362bb8ef6d1..e136d6edc1ed 100644 --- a/drivers/md/bcache/btree.c +++ b/drivers/md/bcache/btree.c @@ -2017,6 +2017,7 @@ int bch_btree_check(struct cache_set *c) if (c->root->level == 0) return 0; + memset(&check_state, 0, sizeof(struct btree_check_state)); check_state.c = c; check_state.total_threads = bch_btree_chkthread_nr(); check_state.key_idx = 0; |