Skip to contentSkip to conversation

Remove unneeded check for xadir in fs/reiserfs/xattr.c

PATCH In review Eric Sesterhenn 2 participants 2 messages Jun 13, 2006 – Jun 14, 2006

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Remove unneeded check for xadir in fs/reiserfs/xattr.c

hi,

coverity complained that xadir is checked for !=NULL
and then passed to lookup_one_len() where it might get dereferenced. This patch removes the check since open_xa_dir() returns an ERR_PTR() or a valid dentry pointer. Coverity id #1194

fs/reiserfs/xattr.c renamed from fs/reiserfs/xattr.c.orig +1 -1
@@ -200,7 +200,7 @@ static struct dentry *get_xa_file_dentry
 	xadir = open_xa_dir(inode, flags);
 	if (IS_ERR(xadir)) {
 		return ERR_PTR(PTR_ERR(xadir));
-	} else if (xadir && !xadir->d_inode) {
+	} else if (!xadir->d_inode) {
 		dput(xadir);
 		return ERR_PTR(-ENODATA);
 	}
#1 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 14 lines · Eric Sesterhenn

hi,

coverity complained that xadir is checked for !=NULL
and then passed to lookup_one_len() where it might get dereferenced. This patch removes the check since open_xa_dir() returns an ERR_PTR() or a valid dentry pointer. Coverity id #1194

fs/reiserfs/xattr.c static struct dentry *get_xa_file_dentry · line 206

Quoted 8 lines
fs/reiserfs/xattr.c renamed from fs/reiserfs/xattr.c.orig +1 -1
@@ -200,7 +200,7 @@ static struct dentry *get_xa_file_dentry
 	xadir = open_xa_dir(inode, flags);
 	if (IS_ERR(xadir)) {
 		return ERR_PTR(PTR_ERR(xadir));
-	} else if (xadir && !xadir->d_inode) {
+	} else if (!xadir->d_inode) {
 		dput(xadir);
 		return ERR_PTR(-ENODATA);
 	}

Looks ok to me.

- -Jeff

- --
Jeff Mahoney
SUSE Labs
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org

iD8DBQFEkB+bLPWxlyuTD7IRAnacAKCO/x/4GvVwktuyaOqbGPGEQujNaQCgkTlV RDm+IISOQgNzGRJ/ynvEHQU=
=dDQr
-----END PGP SIGNATURE-----