* [PATCH][next] btrfs: inode: Fix uninitialized variable bug
@ 2020-03-27 20:01 Gustavo A. R. Silva
2020-04-01 16:00 ` David Sterba
0 siblings, 1 reply; 2+ messages in thread
From: Gustavo A. R. Silva @ 2020-03-27 20:01 UTC (permalink / raw)
To: Chris Mason, Josef Bacik, David Sterba
Cc: linux-btrfs, linux-kernel, Gustavo A. R. Silva
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH][next] btrfs: inode: Fix uninitialized variable bug
2020-03-27 20:01 [PATCH][next] btrfs: inode: Fix uninitialized variable bug Gustavo A. R. Silva
@ 2020-04-01 16:00 ` David Sterba
0 siblings, 0 replies; 2+ messages in thread
From: David Sterba @ 2020-04-01 16:00 UTC (permalink / raw)
To: Gustavo A. R. Silva, osandov
Cc: Chris Mason, Josef Bacik, David Sterba, linux-btrfs, linux-kernel
On Fri, Mar 27, 2020 at 03:01:35PM -0500, Gustavo A. R. Silva wrote:
> 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")
Thanks. This is in a development branch so the fixup can be folded in,
we're expecting more revisions of the patchset anyway. CCing Omar.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-04-01 16:01 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-27 20:01 [PATCH][next] btrfs: inode: Fix uninitialized variable bug Gustavo A. R. Silva
2020-04-01 16:00 ` David Sterba
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).