From: "Gustavo A. R. Silva" <gustavo@embeddedor.com>
To: Chris Mason <clm@fb.com>, Josef Bacik <josef@toxicpanda.com>,
David Sterba <dsterba@suse.com>
Cc: linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org,
"Gustavo A. R. Silva" <gustavo@embeddedor.com>
Subject: [PATCH][next] btrfs: inode: Fix uninitialized variable bug
Date: Fri, 27 Mar 2020 15:01:35 -0500 [thread overview]
Message-ID: <20200327200135.GA3472@embeddedor> (raw)
geom.len is being used without being properly initialized, previously.
Fix this by placing ASSERT(geom.len <= INT_MAX); after geom.len has been
initialized.
Addresses-Coverity-ID: 1491912 ("Uninitialized scalar variable")
Fixes: 1eb52c8bd8d6 ("btrfs: get rid of one layer of bios in direct I/O")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
---
fs/btrfs/inode.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index fce94591e092..00ea02268f54 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -7637,7 +7637,6 @@ static void btrfs_submit_direct_hook(struct btrfs_dio_private *dip)
else
async_submit = 1;
- ASSERT(geom.len <= INT_MAX);
do {
ret = btrfs_get_io_geometry(fs_info, btrfs_op(dio_bio),
start_sector << 9, submit_len,
@@ -7647,6 +7646,8 @@ static void btrfs_submit_direct_hook(struct btrfs_dio_private *dip)
goto out_err;
}
+ ASSERT(geom.len <= INT_MAX);
+
clone_len = min_t(int, submit_len, geom.len);
/*
--
2.26.0
next reply other threads:[~2020-03-27 20:21 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-27 20:01 Gustavo A. R. Silva [this message]
2020-04-01 16:00 ` [PATCH][next] btrfs: inode: Fix uninitialized variable bug David Sterba
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=20200327200135.GA3472@embeddedor \
--to=gustavo@embeddedor.com \
--cc=clm@fb.com \
--cc=dsterba@suse.com \
--cc=josef@toxicpanda.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-kernel@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.