]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs: Fix uninitialized return value in xfs_alloc_fix_freelist()
authorJan Kara <jack@suse.com>
Sun, 23 Aug 2015 22:59:12 +0000 (08:59 +1000)
committerDave Chinner <david@fromorbit.com>
Mon, 24 Aug 2015 01:52:45 +0000 (11:52 +1000)
xfs_alloc_fix_freelist() can sometimes jump to out_agbp_relse
without ever setting value of 'error' variable which is then
returned. This can happen e.g. when pag->pagf_init is set but AG is
for metadata and we want to allocate user data.

Fix the problem by initializing 'error' to 0, which is the desired
return value when we decide to skip this group.

CC: xfs@oss.sgi.com
Coverity-id: 1309714
Signed-off-by: Jan Kara <jack@suse.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
libxfs/xfs_alloc.c

index 9d763296a66244ca9dbdc241edcd12396dc61702..4f3008a1ea185f0ccc87b8ef47e72ac3c8b60297 100644 (file)
@@ -1933,7 +1933,7 @@ xfs_alloc_fix_freelist(
        struct xfs_alloc_arg    targs;  /* local allocation arguments */
        xfs_agblock_t           bno;    /* freelist block */
        xfs_extlen_t            need;   /* total blocks needed in freelist */
-       int                     error;
+       int                     error = 0;
 
        if (!pag->pagf_init) {
                error = xfs_alloc_read_agf(mp, tp, args->agno, flags, &agbp);