Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1543524

[PATCH] btrfs: remove redundant inode null check

From Colin King <colin.king@canonical.com>
Newsgroups linux.kernel
Subject [PATCH] btrfs: remove redundant inode null check
Date 2016-12-16 16:30 +0100
Message-ID <sP2Cl-5qY-27@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


From: Colin Ian King <colin.king@canonical.com>

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.

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).

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 fs/btrfs/export.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/btrfs/export.c b/fs/btrfs/export.c
index 340d907..e90f781 100644
--- a/fs/btrfs/export.c
+++ b/fs/btrfs/export.c
@@ -235,7 +235,7 @@ static int btrfs_get_name(struct dentry *parent, char *name,
 	int ret;
 	u64 ino;
 
-	if (!dir || !inode)
+	if (!dir)
 		return -EINVAL;
 
 	if (!S_ISDIR(dir->i_mode))
-- 
2.10.2

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH] btrfs: remove redundant inode null check Colin King <colin.king@canonical.com> - 2016-12-16 16:30 +0100
  Re: [PATCH] btrfs: remove redundant inode null check David Sterba <dsterba@suse.cz> - 2016-12-20 16:50 +0100

csiph-web