public inbox for linux-bcachefs@vger.kernel.org
 help / color / mirror / Atom feed
From: Gianfranco Trad <gianf.trad@gmail.com>
To: kent.overstreet@linux.dev
Cc: linux-bcachefs@vger.kernel.org, linux-kernel@vger.kernel.org,
	skhan@linuxfoundation.org, Gianfranco Trad <gianf.trad@gmail.com>,
	syzbot+8689d10f1894eedf774d@syzkaller.appspotmail.com
Subject: [PATCH] bcachefs: zero-init move_bucket struct in bch2_copygc_get_buckets()
Date: Mon, 11 Nov 2024 15:42:44 +0100	[thread overview]
Message-ID: <20241111144242.757798-3-gianf.trad@gmail.com> (raw)

zero-init move_bucket struct b fields in bch2_copygc_get_buckets() 
to mitigate later uninit-value-use KMSAN reported bug.

Reported-by: syzbot+8689d10f1894eedf774d@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=8689d10f1894eedf774d
Tested-by: syzbot+8689d10f1894eedf774d@syzkaller.appspotmail.com
Signed-off-by: Gianfranco Trad <gianf.trad@gmail.com>
---
 fs/bcachefs/movinggc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/bcachefs/movinggc.c b/fs/bcachefs/movinggc.c
index d658be90f737..cdc456b03bec 100644
--- a/fs/bcachefs/movinggc.c
+++ b/fs/bcachefs/movinggc.c
@@ -171,7 +171,8 @@ static int bch2_copygc_get_buckets(struct moving_context *ctxt,
 				  lru_pos(BCH_LRU_FRAGMENTATION_START, 0, 0),
 				  lru_pos(BCH_LRU_FRAGMENTATION_START, U64_MAX, LRU_TIME_MAX),
 				  0, k, ({
-		struct move_bucket b = { .k.bucket = u64_to_bucket(k.k->p.offset) };
+		struct move_bucket b = { 0 };
+		b.k.bucket = u64_to_bucket(k.k->p.offset);
 		int ret2 = 0;
 
 		saw++;
-- 
2.43.0


             reply	other threads:[~2024-11-11 14:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-11 14:42 Gianfranco Trad [this message]
2024-11-11 20:09 ` [PATCH] bcachefs: zero-init move_bucket struct in bch2_copygc_get_buckets() Kent Overstreet
2024-11-12 15:08   ` Gianfranco Trad
2024-12-15  1:58     ` Gianfranco Trad
2024-12-15  6:20       ` Kent Overstreet

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=20241111144242.757798-3-gianf.trad@gmail.com \
    --to=gianf.trad@gmail.com \
    --cc=kent.overstreet@linux.dev \
    --cc=linux-bcachefs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=skhan@linuxfoundation.org \
    --cc=syzbot+8689d10f1894eedf774d@syzkaller.appspotmail.com \
    /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