diff options
author | 2018-07-11 22:26:36 -0700 | |
---|---|---|
committer | 2018-07-11 22:26:36 -0700 | |
commit | efe803277364a621348b679058222d644e113c9c (patch) | |
tree | 5ce8b21c6d3aee5caf164b977302f8c299fc23f5 /fs/xfs/libxfs/xfs_alloc.c | |
parent | xfs: remove unused iolock arg from xfs_break_dax_layouts (diff) | |
download | linux-efe803277364a621348b679058222d644e113c9c.tar.gz linux-efe803277364a621348b679058222d644e113c9c.tar.bz2 linux-efe803277364a621348b679058222d644e113c9c.zip |
xfs: Initialize variables in xfs_alloc_get_rec before using them
Make sure we initialize *bno and *len, before jumping to out_bad_rec
label, and risk calling xfs_warn() with uninitialized variables.
Coverity: 100898
Coverity: 1437081
Coverity: 1437129
Coverity: 1437191
Coverity: 1437201
Coverity: 1437212
Coverity: 1437341
Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Diffstat (limited to 'fs/xfs/libxfs/xfs_alloc.c')
-rw-r--r-- | fs/xfs/libxfs/xfs_alloc.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/xfs/libxfs/xfs_alloc.c b/fs/xfs/libxfs/xfs_alloc.c index bd6d8aeea825..3c3f2d5119ea 100644 --- a/fs/xfs/libxfs/xfs_alloc.c +++ b/fs/xfs/libxfs/xfs_alloc.c @@ -223,12 +223,13 @@ xfs_alloc_get_rec( error = xfs_btree_get_rec(cur, &rec, stat); if (error || !(*stat)) return error; - if (rec->alloc.ar_blockcount == 0) - goto out_bad_rec; *bno = be32_to_cpu(rec->alloc.ar_startblock); *len = be32_to_cpu(rec->alloc.ar_blockcount); + if (*len == 0) + goto out_bad_rec; + /* check for valid extent range, including overflow */ if (!xfs_verify_agbno(mp, agno, *bno)) goto out_bad_rec; |