xfs
[Top] [All Lists]

[PATCH] xfs:xfs_dir2_node.c: pointer use before check for null

To: Ben Myers <bpm@xxxxxxx>
Subject: [PATCH] xfs:xfs_dir2_node.c: pointer use before check for null
From: Denis Efremov <yefremov.denis@xxxxxxxxx>
Date: Tue, 22 Oct 2013 11:36:15 +0400
Cc: Denis Efremov <yefremov.denis@xxxxxxxxx>, Alex Elder <elder@xxxxxxxxxx>, xfs@xxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx, ldv-project@xxxxxxxxxxxxxxxx
Delivered-to: xfs@xxxxxxxxxxx
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=FK5LjXyZHhyFOuVi4aymRs/a5jL281QG/6C9qE+VjRc=; b=odhPgxqOiSM5oszPIf93ZEv1Ha95a3ofnU2tADlWPZe51qF2mWgUVWmdcdjStZqm5S xmCYhNI97WuTyfCe08BKW9AlCe/ntP9+zTJnSmQgQEUnSAhRYtwC/8DaIuL+NNeYq1lC WoxV5M/anAQewDgXzqL92aduYx/KmW3t+D/Z4rBN5rFwpRWPDlIU0A8LAD2+XWcYV9Z2 iMTVqwXzyv0K/o13Fel9owZF7dYazdRwEeDBPQJ8HmCOjBmSRnlMiqFMjrTmPHoxJArg VdwgJ62rt6TetNMLP5j+IECaAW30XV86LPmhVcloIpbYmKSIjj+rqRY9XBMyLr9NIja2 rQVg==
Reorder of assert and args pointer dereference.

Found by Linux Driver Verification project (linuxtesting.org) -
PVS-Studio analyzer.

Signed-off-by: Denis Efremov <yefremov.denis@xxxxxxxxx>
---
 fs/xfs/xfs_dir2_node.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/xfs/xfs_dir2_node.c b/fs/xfs/xfs_dir2_node.c
index 4c3dba7..0ba7382 100644
--- a/fs/xfs/xfs_dir2_node.c
+++ b/fs/xfs/xfs_dir2_node.c
@@ -1365,8 +1365,8 @@ xfs_dir2_leafn_split(
         * Allocate space for a new leaf node.
         */
        args = state->args;
-       mp = args->dp->i_mount;
        ASSERT(args != NULL);
+       mp = args->dp->i_mount;
        ASSERT(oldblk->magic == XFS_DIR2_LEAFN_MAGIC);
        error = xfs_da_grow_inode(args, &blkno);
        if (error) {
-- 
1.8.3.1

<Prev in Thread] Current Thread [Next in Thread>