Skip to content

Commit

Permalink
xfs: always set rvalp in xfs_dir2_node_trim_free
Browse files Browse the repository at this point in the history
xfs_dir2_node_trim_free can return with setting the rvalp argument
pointer.  Initialize it to 0 at the beginning of the function and
only update it to 1 if we succeeded trimming a freespace block.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
  • Loading branch information
Christoph Hellwig authored and Dave Chinner committed Mar 15, 2016
1 parent cc07eed commit 355cced
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion fs/xfs/libxfs/xfs_dir2_node.c
Original file line number Diff line number Diff line change
Expand Up @@ -2235,6 +2235,9 @@ xfs_dir2_node_trim_free(

dp = args->dp;
tp = args->trans;

*rvalp = 0;

/*
* Read the freespace block.
*/
Expand All @@ -2255,7 +2258,6 @@ xfs_dir2_node_trim_free(
*/
if (freehdr.nused > 0) {
xfs_trans_brelse(tp, bp);
*rvalp = 0;
return 0;
}
/*
Expand Down

0 comments on commit 355cced

Please sign in to comment.