Skip to content

Commit 0f38063

Browse files
Andrey StrachukDarrick J. Wong
authored andcommitted
xfs: removed useless condition in function xfs_attr_node_get
At line 1561, variable "state" is being compared with NULL every loop iteration. ------------------------------------------------------------------- 1561 for (i = 0; state != NULL && i < state->path.active; i++) { 1562 xfs_trans_brelse(args->trans, state->path.blk[i].bp); 1563 state->path.blk[i].bp = NULL; 1564 } ------------------------------------------------------------------- However, it cannot be NULL. ---------------------------------------- 1546 state = xfs_da_state_alloc(args); ---------------------------------------- xfs_da_state_alloc calls kmem_cache_zalloc. kmem_cache_zalloc is called with __GFP_NOFAIL flag and, therefore, it cannot return NULL. -------------------------------------------------------------------------- struct xfs_da_state * xfs_da_state_alloc( struct xfs_da_args *args) { struct xfs_da_state *state; state = kmem_cache_zalloc(xfs_da_state_cache, GFP_NOFS | __GFP_NOFAIL); state->args = args; state->mp = args->dp->i_mount; return state; } -------------------------------------------------------------------------- Found by Linux Verification Center (linuxtesting.org) with SVACE. Signed-off-by: Andrey Strachuk <[email protected]> Fixes: 4d0cdd2 ("xfs: clean up xfs_attr_node_hasname") Reviewed-by: Darrick J. Wong <[email protected]> Signed-off-by: Darrick J. Wong <[email protected]>
1 parent 70b589a commit 0f38063

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/xfs/libxfs/xfs_attr.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1558,7 +1558,7 @@ xfs_attr_node_get(
15581558
* If not in a transaction, we have to release all the buffers.
15591559
*/
15601560
out_release:
1561-
for (i = 0; state != NULL && i < state->path.active; i++) {
1561+
for (i = 0; i < state->path.active; i++) {
15621562
xfs_trans_brelse(args->trans, state->path.blk[i].bp);
15631563
state->path.blk[i].bp = NULL;
15641564
}

0 commit comments

Comments
 (0)