btrfs: fix dereference of ERR_PTR value
authorDavid Sterba <dsterba@suse.cz>
Mon, 13 Jun 2011 17:54:22 +0000 (17:54 +0000)
committerChris Mason <chris.mason@oracle.com>
Fri, 17 Jun 2011 18:54:17 +0000 (14:54 -0400)
smatch reports:

btrfs_recover_log_trees error: 'wc.replay_dest' dereferencing
possible ERR_PTR()

Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
fs/btrfs/tree-log.c

index 592396c6dc47465bccf4422d6259d0dfe2885e0c..4ce8a9f41d1ec3916753bd610183a82b4dc6aa21 100644 (file)
@@ -3177,7 +3177,7 @@ again:
                tmp_key.offset = (u64)-1;
 
                wc.replay_dest = btrfs_read_fs_root_no_name(fs_info, &tmp_key);
-               BUG_ON(!wc.replay_dest);
+               BUG_ON(IS_ERR_OR_NULL(wc.replay_dest));
 
                wc.replay_dest->log_root = log;
                btrfs_record_root_in_trans(trans, wc.replay_dest);