summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorColin Ian King <colin.king@canonical.com>2016-12-20 11:18:37 -0500
committerDavid Sterba <dsterba@suse.com>2017-02-14 09:50:50 -0500
commit694a0dee9c2d36a552f31a1b104733ed3f90f46d (patch)
treec324a380c6fd48d535c53d3cce61926c37291437
parent20c7bcec6f8fcc305f1f2a2488657836ca8be69d (diff)
btrfs: remove redundant inode null check
The check for a null inode is redundant since the function is a callback for exportfs, which will itself crash if dentry->d_inode or parent->d_inode is NULL. Removing the null check makes this consistent with other file systems. Also remove the redundant null dir check too. Found with static analysis by CoverityScan, CID 1389472 Kudos to Jeff Mahoney for reviewing and explaining the error in my original patch (most of this explanation went into the above commit message) and David Sterba for pointing out that the dir check is also redundant. Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: David Sterba <dsterba@suse.com>
-rw-r--r--fs/btrfs/export.c3
1 files changed, 0 insertions, 3 deletions
diff --git a/fs/btrfs/export.c b/fs/btrfs/export.c
index 340d90751263..4f774314a0dc 100644
--- a/fs/btrfs/export.c
+++ b/fs/btrfs/export.c
@@ -235,9 +235,6 @@ static int btrfs_get_name(struct dentry *parent, char *name,
235 int ret; 235 int ret;
236 u64 ino; 236 u64 ino;
237 237
238 if (!dir || !inode)
239 return -EINVAL;
240
241 if (!S_ISDIR(dir->i_mode)) 238 if (!S_ISDIR(dir->i_mode))
242 return -EINVAL; 239 return -EINVAL;
243 240