btrfs: inode: Fix uninitialized variable bug
PATCH 1/1 btrfs: inode: Fix uninitialized variable bug
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 <[email protected]>
--- fs/btrfs/inode.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/btrfs/inode.c +2 -1
@@ -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);/*
Signature · 1 line
2.26.0
Quoted 7 lines · 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")
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.