Commit 694a0dee authored by Colin Ian King's avatar Colin Ian King Committed by David Sterba

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: default avatarColin Ian King <colin.king@canonical.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 20c7bcec
...@@ -235,9 +235,6 @@ static int btrfs_get_name(struct dentry *parent, char *name, ...@@ -235,9 +235,6 @@ static int btrfs_get_name(struct dentry *parent, char *name,
int ret; int ret;
u64 ino; u64 ino;
if (!dir || !inode)
return -EINVAL;
if (!S_ISDIR(dir->i_mode)) if (!S_ISDIR(dir->i_mode))
return -EINVAL; return -EINVAL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment