xfs: fix incorrect test in xfs_alloc_ag_vextent_lastblock
PATCH 1/1 xfs: fix incorrect test in xfs_alloc_ag_vextent_lastblock
From: Darrick J. Wong <[email protected]>
When I lifted the code in xfs_alloc_ag_vextent_lastblock out of a loop, I forgot to convert all the accesses to len to be pointer dereferences.
Coverity-id: 1457918
Fixes 5113f8ec3753ed ("xfs: clean up weird while loop in xfs_alloc_ag_vextent_near")
Signed-off-by Darrick J. Wong <[email protected]>
--- fs/xfs/libxfs/xfs_alloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/xfs/libxfs/xfs_alloc.c +1 -1
@@ -1514,7 +1514,7 @@ xfs_alloc_ag_vextent_lastblock(* maxlen, go to the start of this block, and skip all those smaller * than minlen. */ -if (len || args->alignment >1 ) { +if (*len || args->alignment >1 ) { acur->cnt->bc_ptrs[0 ] =1 ; do { error = xfs_alloc_get_rec(acur->cnt, bno, len, &i);
Quoted 9 lines · Darrick J. Wong
From: Darrick J. Wong <[email protected]>
When I lifted the code in
xfs_alloc_ag_vextent_lastblockout of a loop, I forgot to convert all the accesses to len to be pointer dereferences.Coverity-id: 1457918
Fixes 5113f8ec3753ed ("xfs: clean up weird while loop in xfs_alloc_ag_vextent_near")Signed-off-by Darrick J. Wong <[email protected]>---
Reviewed-by Brian Foster <[email protected]>
Quoted 17 lines
fs/xfs/libxfs/xfs_alloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fs/xfs/libxfs/xfs_alloc.c +1
-1@@ -1514,7 +1514,7 @@ xfs_alloc_ag_vextent_lastblock(* maxlen, go to the start of this block, and skip all those smaller * than minlen. */ -if (len || args->alignment >1 ) { +if (*len || args->alignment >1 ) { acur->cnt->bc_ptrs[0 ] =1 ; do { error = xfs_alloc_get_rec(acur->cnt, bno, len, &i);
fs/xfs/libxfs/xfs_alloc.c xfs_alloc_ag_vextent_lastblock( · line 1520
Quoted 13 lines · Darrick J. Wong
fs/xfs/libxfs/xfs_alloc.c +1
-1@@ -1514,7 +1514,7 @@ xfs_alloc_ag_vextent_lastblock(* maxlen, go to the start of this block, and skip all those smaller * than minlen. */ -if (len || args->alignment >1 ) { +if (*len || args->alignment >1 ) { acur->cnt->bc_ptrs[0 ] =1 ; do { error = xfs_alloc_get_rec(acur->cnt, bno, len, &i);
The change definitivelly restores the old behavior. Looks good:
Reviewed-by Christoph Hellwig <[email protected]>