public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xfs: always set rvalp in xfs_dir2_node_trim_free
@ 2016-03-11  9:42 Christoph Hellwig
  2016-03-11 11:05 ` Carlos Maiolino
  0 siblings, 1 reply; 2+ messages in thread
From: Christoph Hellwig @ 2016-03-11  9:42 UTC (permalink / raw)
  To: xfs

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.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 fs/xfs/libxfs/xfs_dir2_node.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/fs/xfs/libxfs/xfs_dir2_node.c b/fs/xfs/libxfs/xfs_dir2_node.c
index 63ee03d..75a5574 100644
--- a/fs/xfs/libxfs/xfs_dir2_node.c
+++ b/fs/xfs/libxfs/xfs_dir2_node.c
@@ -2235,6 +2235,9 @@ xfs_dir2_node_trim_free(
 
 	dp = args->dp;
 	tp = args->trans;
+
+	*rvalp = 0;
+
 	/*
 	 * Read the freespace block.
 	 */
@@ -2255,7 +2258,6 @@ xfs_dir2_node_trim_free(
 	 */
 	if (freehdr.nused > 0) {
 		xfs_trans_brelse(tp, bp);
-		*rvalp = 0;
 		return 0;
 	}
 	/*
-- 
2.1.4

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] xfs: always set rvalp in xfs_dir2_node_trim_free
  2016-03-11  9:42 [PATCH] xfs: always set rvalp in xfs_dir2_node_trim_free Christoph Hellwig
@ 2016-03-11 11:05 ` Carlos Maiolino
  0 siblings, 0 replies; 2+ messages in thread
From: Carlos Maiolino @ 2016-03-11 11:05 UTC (permalink / raw)
  To: xfs; +Cc: hch

I was just sending this patch when I saw yours.

Looks good to me:

Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>

On Fri, Mar 11, 2016 at 10:42:17AM +0100, Christoph Hellwig wrote:
> 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.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
>  fs/xfs/libxfs/xfs_dir2_node.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/xfs/libxfs/xfs_dir2_node.c b/fs/xfs/libxfs/xfs_dir2_node.c
> index 63ee03d..75a5574 100644
> --- a/fs/xfs/libxfs/xfs_dir2_node.c
> +++ b/fs/xfs/libxfs/xfs_dir2_node.c
> @@ -2235,6 +2235,9 @@ xfs_dir2_node_trim_free(
>  
>  	dp = args->dp;
>  	tp = args->trans;
> +
> +	*rvalp = 0;
> +
>  	/*
>  	 * Read the freespace block.
>  	 */
> @@ -2255,7 +2258,6 @@ xfs_dir2_node_trim_free(
>  	 */
>  	if (freehdr.nused > 0) {
>  		xfs_trans_brelse(tp, bp);
> -		*rvalp = 0;
>  		return 0;
>  	}
>  	/*
> -- 
> 2.1.4
> 
> _______________________________________________
> xfs mailing list
> xfs@oss.sgi.com
> http://oss.sgi.com/mailman/listinfo/xfs

-- 
Carlos

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-03-11 11:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-11  9:42 [PATCH] xfs: always set rvalp in xfs_dir2_node_trim_free Christoph Hellwig
2016-03-11 11:05 ` Carlos Maiolino

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox