From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
stable@vger.kernel.org, Coly Li <colyli@suse.de>,
Jens Axboe <axboe@kernel.dk>
Subject: [PATCH 5.18 3/6] bcache: memset on stack variables in bch_btree_check() and bch_sectors_dirty_init()
Date: Thu, 30 Jun 2022 15:47:29 +0200 [thread overview]
Message-ID: <20220630133230.342925455@linuxfoundation.org> (raw)
In-Reply-To: <20220630133230.239507521@linuxfoundation.org>
From: Coly Li <colyli@suse.de>
commit 7d6b902ea0e02b2a25c480edf471cbaa4ebe6b3c upstream.
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/md/bcache/btree.c | 1 +
drivers/md/bcache/writeback.c | 1 +
2 files changed, 2 insertions(+)
--- 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;
--- a/drivers/md/bcache/writeback.c
+++ b/drivers/md/bcache/writeback.c
@@ -950,6 +950,7 @@ void bch_sectors_dirty_init(struct bcach
return;
}
+ memset(&state, 0, sizeof(struct bch_dirty_init_state));
state.c = c;
state.d = d;
state.total_threads = bch_btre_dirty_init_thread_nr();
next prev parent reply other threads:[~2022-06-30 14:12 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-30 13:47 [PATCH 5.18 0/6] 5.18.9-rc1 review Greg Kroah-Hartman
2022-06-30 13:47 ` [PATCH 5.18 1/6] tick/nohz: unexport __init-annotated tick_nohz_full_setup() Greg Kroah-Hartman
2022-06-30 13:47 ` [PATCH 5.18 2/6] clocksource/drivers/ixp4xx: Drop boardfile probe path Greg Kroah-Hartman
2022-06-30 13:47 ` Greg Kroah-Hartman [this message]
2022-06-30 13:47 ` [PATCH 5.18 4/6] hinic: Replace memcpy() with direct assignment Greg Kroah-Hartman
2022-06-30 13:47 ` [PATCH 5.18 5/6] powerpc/ftrace: Remove ftrace init tramp once kernel init is complete Greg Kroah-Hartman
2022-06-30 13:47 ` [PATCH 5.18 6/6] io_uring: fix not locked access to fixed buf table Greg Kroah-Hartman
2022-06-30 17:09 ` [PATCH 5.18 0/6] 5.18.9-rc1 review Jon Hunter
2022-06-30 22:35 ` Zan Aziz
2022-06-30 23:19 ` Shuah Khan
2022-06-30 23:46 ` Florian Fainelli
2022-07-01 0:58 ` Guenter Roeck
2022-07-01 4:17 ` Ron Economos
2022-07-01 5:59 ` Naresh Kamboju
2022-07-01 7:59 ` Bagas Sanjaya
2022-07-01 8:24 ` Greg Kroah-Hartman
2022-07-01 9:00 ` Bagas Sanjaya
2022-07-01 10:31 ` Sudip Mukherjee
2022-07-04 14:40 ` Greg Kroah-Hartman
2022-07-01 10:25 ` Sudip Mukherjee
2022-07-01 11:53 ` Rudi Heitbaum
2022-07-01 11:56 ` Rudi Heitbaum
2022-07-01 17:45 ` Justin Forbes
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220630133230.342925455@linuxfoundation.org \
--to=gregkh@linuxfoundation.org \
--cc=axboe@kernel.dk \
--cc=colyli@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox